When you recognize a command name but forget its purpose, whatis can provide a short reminder from the manual-page database.
Command Line · Lesson 17
whatis
Learn how to retrieve concise manual-page descriptions and interpret their section numbers.
Looking Up an Exact Name
Pass one or more exact topic names to whatis. Each result is derived from the NAME section recorded for an installed manual page:
$ whatis cat
cat (1) - concatenate files and print on the standard output
The output is a description, not a list of command options or examples. Use man cat or cat --help when you need more detail.
You know the name cat and want its one-line manual-page description. Which command should you run?
Reading Section Numbers
If the same topic has manual pages in several sections, whatis can display more than one result:
$ whatis passwd
passwd (1) - change user password
passwd (5) - the password file
The number in parentheses is the manual section. Here, passwd(1) describes the user command and passwd(5) describes a file format. You can open one explicitly with man 1 passwd or man 5 passwd.
In the output passwd (5) - the password file, what does (5) identify?
Choosing between whatis, man, and apropos
whatis NAME: Show concise descriptions for an exact manual topic name.man NAME: Open a full manual page.apropos KEYWORD: Search manual-page names and descriptions for a keyword.
For example:
$ apropos password
Use apropos when you know the task but not the command name. Use whatis when you already know the name.
You do not know a command's name, but you want to search manual descriptions for the keyword password. Which command fits that task?
When No Description Appears
If whatis reports that nothing is appropriate, the topic may not have an installed manual page or the manual database may be out of date. This result does not prove that no executable, alias, function, or builtin with that name exists. Use type NAME to see how Bash resolves a command name, then choose an appropriate help source.
whatis deploy finds no manual description. Which command checks whether Bash resolves deploy as an alias, function, builtin, or executable?
Lesson complete
You finished whatis
You can now retrieve and interpret concise descriptions from the manual database.
Look up an exact topic with
whatis.Read the manual section shown in parentheses.
Use
manwhen you need the full page.Use
aproposwhen you know a keyword rather than a name.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account