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]
1. 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:

Here’s a sample output of what you might see when you run whatis ls mkdir:

ls (1)               - list directory contents
mkdir (1)            - make directories

In this example:

  • ls (1) is the ls command, and the (1) refers to the section of the man pages that ls is found in. The description “list directory contents” is a brief summary of what the ls command does.
  • mkdir (1) is the mkdir command, and the (1) refers to the section of the man pages that mkdir is found in. The description “make directories” is a brief summary of what the mkdir command does.
2. 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.

3. 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:

When you run whatis -r cp, it will return a list of all the commands that match the regular expression cp.

cp (1)               - copy files and directories
cpio (1)             - copy files to and from archives
scp (1)              - secure copy (remote file copy program)
gcp (1)              - advanced file copier
4. 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:

whatis -w cd* will display descriptions for all commands in the man pages that start with “cd”.

cd (1)               - change the shell working directory
cdrecord (1)         - record audio or data Compact Discs or Digital Versatile Discs from a master
cdrdao (1)           - writes audio CD-Rs in disc-at-once (DAO) mode
cdparanoia (1)       - an audio CD reading utility which includes extra data verification features
5. Using Manual Pages from other OS
whatis -m [manual_directory] [command]

The -m option provides access to path to the directory containing the manual pages you want to search.

Example:

If you search for the cat command from /opt/myprogram/man, here what you will get:

cat (1) - concatenate files and print on the standard output
More Linux commands:
Directory Operations rmdir · cd · pwd · exa · ls
File Operations cat · cp · dd · less · touch · ln · rename · more · head
File System Operations chown · mkfs · locate
Networking ping · curl · wget · iptables · mtr
Search and Text Processing find · grep · sed · whatis · ripgrep · fd · tldr
System Information and Management env · history · top · who · htop · glances · lsof
User and Session Management screen · su · sudo · open
WebsiteFacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenWhatsappEmail