UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 50.1 UNIX Online Documentation Chapter 50
Help--Online Documentation, etc.
Next: 50.3 apropos on Systems Without apropos
 

50.2 The apropos Command

The biggest problem with the UNIX manual set is finding what you want, given that you don't already know what you're looking for. For example: you want to search for a string in a file. If you don't remember that the command you want is called grep, how will you ever find it?

The apropos command, which is equivalent to man -k (and sometimes just an alias for man -k) helps to solve this problem. It's not always successful, but it's better than nothing. It looks through headings of all the "man pages" and prints any that match a given keyword. For example, to figure out how to search for a string, try the command:

% apropos string
...
gets, fgets (3S)        - get a string from a stream
getsubopt (3)           - parse sub options from a string
gettext, textdomain (3) - retrieve a message string, get & set text domain
grep, egrep, fgrep (1V) - search a file for a string or regular expression
puts, fputs (3S)        - put a string on a stream
...

We've cut some of the output for convenience, but you can see what you want: to search for a string, you clearly want to use grep or one of its relatives.

All BSD and SVR4 systems support apropos. However, there are plenty of SVR3 (and earlier) systems kicking around that don't. If you're facing this problem, see article 50.3.

MILD FLAME: Over the years, the output from apropos has gotten quite cluttered. It's considerably less useful now than it was ten years ago.

- ML


Previous: 50.1 UNIX Online Documentation UNIX Power ToolsNext: 50.3 apropos on Systems Without apropos
50.1 UNIX Online Documentation Book Index50.3 apropos on Systems Without apropos

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System


Banner.Novgorod.Ru