Getting Command Summaries with whatis and apropos

As you first explore your OpenLinux system, you might come across programs whose function is not clear. Many Linux programs are designed to give at least a little help with a ?, -help or --help option on the command line, but you generally shouldn't run a pro­gram without knowing what it does.The whatis command might be able to help you quickly find out what a program is with a summary line derived from the program's manual page. For example, to find out what is who, you can enter the following:

# whatis who

Your screen clears, and the whatis command displays a summary like so: who (1)       - show who is logged on

Press Q to quit the whatis command. However, unlike the locate command, you must first build a database of the command summaries with the makewhatis command, which is found under the /usr/sbin directory. To do this, make sure you're logged in as root, and enter the following:

# makewhatis

The makewhatis command, like the updatedb command, takes a few minutes to build the whatis database, which is called whatis and is found under the /usr/man/man1 direc­tory. The makewhatis command has several options but does not have a manual page. To see a quick summary, use the following:

# makewhatis -?

You need to periodically update the whatis database to keep track of any newly installed programs. See Hour 24 for tips on how to make OpenLinux do this automatically.

Now you see how whereis and whatis can help you find programs or figure out what they do. But what if you want to do something but can't remember which program does what? In this case, you can turn to the apropos command.

For example, if you can't remember which command searches for files, you can enter the following:

# apropos search

apropos (1) - search the whatis database for strings

badblocks (8) - search a device for bad blocks

bsearch (3) - binary search of a sorted array.

conflict (8) - search for alias/password conflicts

find (1) - search for files in a directory hierarchy

hcreate, hdestroy, hsearch (3) - hash table management

lfind, lsearch (3) - linear search of an array.

lkbib (1) - search bibliographic databases

lookbib (1) - search bibliographic databases

lsearch (n) - See if a list contains a particular element

manpath (1) - determine user's search path for man pages

strpbrk (3) - search a string for any of a set of characters

strspn, strcspn (3)    - search a string for a set of characters

tsearch, tfind, tdelete, twalk (3) - manage a binary treewhatis (1) - search the whatis database for complete words,

zgrep (1) - search possibly compressed files for

^ a regular expression

zipgrep (1) - search possibly zip files for

^ a regular expression

You see a list of programs from the whatis database on your screen. Press the Q key when you finish reading the list. The apropos command uses this database to search for the keyword you entered. If you keep your whatis database up-to-date, you're able to use apropos to help you find the program you need.


You can also use the man command's K option to do the same thing as apropos, but the search is slow and presents each manual page in the search result. For example, to search for any programs dealing with PostScript, you

can try the following: # man -K PostScript

This can result in the following output, before you quit with Q:

/usr/man/man7/unicode.7? [ynq] n /usr/man/man7/suffixes.7? [ynq] n /usr/man/man7/groff_char.7? [ynq] n /usr/man/man1/convert.1x? [ynq] n /usr/man/man1/xv.1? [ynq] n /usr/man/man1/xdvi.1? [ynq] n /usr/man/man1/dvips.1? [ynq] n /usr/man/man1/afm2tfm.1? [ynq] n /usr/man/man1/ps2pk.1? [ynq] n /usr/man/man1/ps2frag.1? [ynq] q