Command Line · Lesson 17 of 19

whatis

0 / 4 checkpoints answered

Full screen ↗

When you recognize a command name but forget its purpose, whatis can provide a short reminder from the manual-page database.

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.

CheckYou 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.

CheckIn 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.

CheckYou 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.

Checkwhatis deploy finds no manual description. Which command checks whether Bash resolves deploy as an alias, function, builtin, or executable?

Summary

You can now retrieve and interpret concise descriptions from the manual database.

  1. Look up an exact topic with whatis.
  2. Read the manual section shown in parentheses.
  3. Use man when you need the full page.
  4. Use apropos when you know a keyword rather than a name.