Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

apropos works great for searching manual page names and descriptions. Is there a similar command for searching the entire contents of the manual pages?

share|improve this question
    
I edited the title. Hope that makes it clearer. –  phunehehe Mar 10 '11 at 14:50

3 Answers 3

up vote 8 down vote accepted

By using the command man man we can see that we have two options.

   -k     Equivalent to apropos.

   -K     Search  for  the  specified  string in *all* man pages. Warning:
          this is probably very slow!  It  helps  to  specify  a  section.
          (Just  to  give  a  rough idea, on my machine this takes about a
          minute per 500 man pages.)

This is on a RHEL 5 system

share|improve this answer

This is probably late. But I just completed my Google Summer of Code project for NetBSD and my task was exactly this. Implementing full text search for man pages.

The code is here: https://github.com/abhinav-upadhyay/apropos_replacement

Although at the moment this is for only *BSD (NetBSD to be precise but should work with other BSDs with some small adjustments) systems due to some assumptions made while writing the code and I don't have a Linux machine around me to fix or port this for working on Linux.

You can look it in action in this blog post

Shameless Plug: I am also working in implementing a spell corrector to this apropos and hopefully we will set up a CGI version on http://netbsd.org as well.

share|improve this answer

two options for you. first, you can try this script:

#!/bin/bash
for MANFILE in /usr/share/man/man?/*
do
    found=`zcat $MANFILE | grep -c "$1"`
    if [ $found -gt 0 ]; then
        echo "------ Found in $MANFILE"
        man -P cat $MANFILE | grep --color=auto "$1"
    fi
done

save it as searchman.sh or some-such, and, optionally make it executable and stick it somewhere in your $PATH. The just run sh searchman.sh <query>. (note: i've just thrown this together quickly now. I've tested it and it looks to be all good, but it might need tweaking here and there.)

secondly, and especially if you're using Ubuntu, you can use http://manpages.ubuntu.com/ - there are a number of full-text search options available.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.