When the other techniques in this chapter don't find the information you want, you can try searching the files. You'll probably have to wade through a lot of stuff that you don't want to see, but this method can work when nothing else does. As an example, you remember that there's some command for chopping columns out of a file. You try , but it only mentions colrm and pr , and those aren't what you want. You'll usually be able to narrow your search to one or two ; here, you know that user commands are in section 1. So you go to the manual pages and do a case-insensitive search through all the files for "column" or "chop":
It's cut ! Notice that awk also handles columns, but apropos doesn't say so.
(I cheated on that example: there were other ways to find
, for instance.
But this method does work in tougher cases.)
To search the manual page files, you'll need to know where they're
There are lots of possibilities, but the directories
are good places to look.
If the command is local, try
You'll probably find subdirectories with names like man1 , man2 , ... and/or cat1 , cat2 , .... Directory names like manN will have unformatted source files for section N ; the catN directories have formatted source files. Or you may just find files named command.N , where N is 1 for section 1, 2 for section 2, and so on.
There are two types of manpage files: unformatted (shown in article 50.11 ) and formatted (with overstriking, as in article 43.18 ). The unformatted pages are easier to search because none of the words will have embedded backspace characters. The example above shows how. The unformatted pages have commands and macros in them, though, which can make searching and reading tougher.
To search formatted pages, you'll want to strip the embedded backspace characters. Otherwise, grep might miss the word you want because it was boldfaced or underlined - with backspaces in it. In the example below, aapplies a series of commands to each file. First, removes the overstriking. grep does a search (case-insensitive, as before). Because grep is reading its standard input, it doesn't know the filename, so a little sed command adds the name to the start of every line grep outputs.
In Bourne shells, you can pipe the output of that loop to a pager (like
done | less