whatis Command in Linux with Examples

In Linux, the “whatis” command is used to offer a one-line description of command-line programs or a flag (i.e., all-text mode programs) and other topics related to Linux and other Unix-like OS. For example, each manual section in Linux contains some definitions. This command looks for the manual and displays the description of the given keyword.

It completes this by searching the short descriptions in the whatis database for each keyword provided 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 built into most Unix-like systems.

Syntax:

The syntax of the “whatis” command is:

Whatis keyword(s)

For example, the following whatis command 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 search for information about multiple topics simultaneously. 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

What is Man Command in Linux [aka Manual Pages]?

Man pages or manual pages are one of the most helpful resources to learn about a particular command from the terminal. A man page of a command contains a lot of descriptions about the command. In addition, there may be a time when you are stuck while executing a command; in such cases, you can simply access the manual page to get more information about that command.

To explore a manual page of any command, execute the command as follows:

man command_ name  

The above command will work for all the Linux commands. Consider the below output:

What is Man Command in Linux [aka Manual Pages]

The above output displays the manual page of the cat command. Similarly, we can list the manuals of any command in Linux.

How to use whatis command

If you want to know about any command in Linux OS, simply enter the name of the command or tool as a parameter:

$ whatis ls

The following output was produced by the aforementioned command:

ls (1)               - list directory contents

How to get information of multiple commands

If you want to know the information about multiple commands simultaneously, enter all the names as input:

$ whatis ls cp rm mv

And here’s the output produced by this command:

ls (1)               - list directory contents
cp (1)               - copy files and directories
rm (1)               - remove files or directories
mv (1)               - move (rename) files

So, above can see the whatis command handles multiple inputs easily.

Various options of the whatis command

Let’s discuss the various options of the “whatis” command:

  1. –?-h, –help
  2. D, –debug
  3. -v, verbose
  4. –r, regex
  5. -w, a wildcard
  6. -l, long
  7. -s, –section=LIST
  8. -m, –system=SYSTEM
  9. –M, –manpath=PATH
  10. -L, –locale=LOCALE
  11. -L, –locale=LOCALE
  12. –version
  1. –?-h, –help:

    Use “–help” or “?” with whatis command to get help. Run any one command from them:

$ whatis -?
$ whatis –help

Or

$whatis -h

Various options of the whatis command

  1. D, –debug:

    Use the “-d” option to get debugging information:

whatis -d pwd

whatis debug command in linux

  1. -v, verbose:

    Use the “-v” option to get verbose detail of a command:

whatis –v pwd

whatis verbose command in linux

  1. –r, regex

    Each name is interpreted as a regular expression with this option. When the name matches, the connection will be made:

whatis –r pwd

whatis regex command in linux

  1. -w, a wildcard

    Each name is interpreted as a sequence containing shell-style wildcards with this option. An extended name should be matched to the page name:

whatis -w pwd

whatis wildcard command in linux

  1. -l, long

    This option will not trim output to suit the width of the terminal:

whatis -l

whatis long command in linux

  1. -s, –section=LIST

    Use the “-s” option to check the manual sections specified. The section list is divided by a colon or a comma. If a list entry has any perspective section. Then it will display the information of a given keyword. Otherwise, it will display nothing appropriate:

$whatis –s 4 reboot

whatis manual selection command in linux

whatis 2x reboot

whatis manual selection reboot command in linux

  1. -m, –system=SYSTEM

    Using the “-m” NewOS option to scan for the names of NewOS’ manual page. NewOS is a Linux operating system.

whatis -m NewOS rmdir

whatis newos option command in linux

  1. –M, –manpath=PATH

    The “-M” option allows you to browse through a different collection of colon-delimited manual page hierarchies:

whatis name –M --mathpath=/lib/pwd

whatis manual page command in linux

  1. -L, –locale=LOCALE

    Use the “-L” option to override the given keyword temporarily. Locale is directly supplying a string to whatis:

whatis ps -L locale

whatis override command in linux

  1. –usage

    This option will exit after printing quick usage information:

whatis --usage

whatis print quick usage command in linux

  1. –version

    To display the version information, use “–V” with the “whatis” command option:

whatis -V

whatis version information command in linux

The Bottom Line

The whatis command helps in getting a short explanation of any command line. It goes through the manuals of all the commands and displays a brief description of the given keyword. First, we covered the usage of the “whatis” command and its several options.