How to Use the Whatis Command in Linux

It’s quite similar to “man” except this command only prints the one line description of the given command. It’s handy to get what’s the command is for without the additional details.

General syntax for whatis command:

whatis [OPTIONS...] [COMMAND]
Display information about (multiple) commands
whatis [command] [command]

The whatis command may be used to provide a brief manual page description of multiple of Linux commands. To do this, just specify a few commands.

Example: Printing brief information about the ls and mkdir commands

display info multiple commands
Turn off output trimming
whatis -l [command]

To display the output without any trimming, run the whatis command with the -l option.

Example: Let’s use the whatis command with and without this option to see the difference.

turn off output trim
Display debugging information
whatis -d [command]

To display debugging information about a Linux command in the terminal, use the whatis command with the -d option.

Example: Displaying debug information about the cp command

display debug info
Search by Regular Expression
whatis -r [command]

The -r option searches for commands by keyword name. If any of the names match any part of the page name, it outputs that match.

Example: Let’s print a short description of the commands that match the cd pattern.

search by regex
Search commands by pattern
whatis -w [command* or *command]

Use the -w option to search Linux commands using a wild card. Specify a pattern to search for commands matching that pattern.

Example: Let’s find the commands that start with the cd command pattern.

search by pattern
Using Manual Pages from other OS
whatis -m [system] [command]

The -m option provides access to the manual page names of the other systems.

Example: Let’s search for the cat command from the NewOne system and get a brief description of this command.

manual pages
Set the Search Path for Manual Pages
whatis -M [system] [command]

To set an alternative search path for manual pages, use the -M option. By default, whatis uses the $MANPATH environment variable.

Example: Specifying the default search path for manual pages –manpath=/lib and searching there for the mkdir command

manual page search path