LINFO

The whatis Command


The whatis command provides very brief descriptions of command line programs (i.e., all-text mode programs) and other topics related to Linux and other Unix-like operating systems.

It accomplishes this by searching the short descriptions in the whatis database for each keyword provided to it as an argument (i.e., input data). This database contains just the title, section number and description from the NAME section of each page in the man manual that is built into most Unix-like systems.

The syntax for whatis is:

whatis keyword(s)

For example, the following provides a single line summary of the head command (which by default displays the first ten lines of each file that is provided to it as an argument):

whatis head

whatis can be used to simultaneously search for information about multiple topics. For example, the following would provide information about both head and tail (which by default reads the final ten lines of files):

whatis head tail

The output of whatis is limited by the fact that it provides only a single line for each keyword found in the database; thus it supplies incomplete information about even moderately complex commands. For example, the following use of whatis to obtain information about the cat command generates the output "concatenate files and print on the standard output":

whatis cat

However, this omits some important information about cat, particularly the facts that it is very convenient to use for reading files and that it is also used to create and write to files.

whatis is similar to the apropos command. However, apropos is more powerful in that its arguments are not limited to complete words but can also be strings (i.e., any finite sequences of characters) which comprise parts of words. Both commands are unusual in that they have no options.

The man command (which is used to read the built-in manual pages), when used with its -f option, produces the same output as whatis. Thus, for example,

man -f cat

is equivalent to

whatis cat

The whatis database is a plain text (i.e., human-readable characters) file that is generated automatically by the makewhatis program. Its location varies according to the particular system; in the case of Red Hat Linux 9, for example, its full path is /var/cache/man/whatis.

If desired, the database can be viewed using a command such as the following:

cat /var/cache/man/whatis | less

In this command the output of cat /var/cache/man/whatis is piped (i.e., sent) to the less command in order to make it easier to read by displaying only a single page at a time rather than scrolling down the screen at high speed.




Created May 18, 2005. Updated May 7, 2007.
Copyright © 2005 The Linux Information Project. All Rights Reserved.