The “whatis” command is a Unix/Linux utility that allows you to quickly search and display one-line descriptions of commands or topics from the system’s manual pages.
Manual pages (also known as “man pages”) are built-in documentation for Unix/Linux commands and other system utilities. Each manual page typically includes a detailed description of the command, its syntax, options, and examples of usage.
However, manual pages can be lengthy and difficult to search through. This is where the “whatis” command comes in handy. By typing “whatis” followed by a keyword or command, you can quickly get a one-line description of what that command does or what a particular topic is about.
For example, if you type “whatis ls”, you will get a one-line description of the “ls” command, which is used to list the contents of a directory. Similarly, if you type “whatis SSH”, you will get a one-line description of the SSH (Secure Shell) protocol, which is used for secure remote login and file transfer.
The “whatis” command is useful for quickly looking up the basic functionality of a command or topic without having to read through its entire manual page. It can be especially helpful for beginners who are just starting to learn Unix/Linux commands and need a quick reference.
You can also use the “whatis” command with wildcards to search for multiple commands or topics at once. For example, typing “whatis -w ‘network'” will display a list of all manual pages that contain the word “network” in their descriptions.
If you encounter the below error while running the command whatis:
whatis: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install man-db |
Ubuntu | apt-get install man-db |
Arch Linux | pacman -S man-db |
Kali Linux | apt-get install man-db |
CentOS | yum install man-db |
Fedora | dnf install man-db |
Raspbian | apt-get install man-db |
whatis Command Examples
1. Display a description from a man page:
# whatis command
2. Don’t cut the description off at the end of the line:
# whatis --long command
3. Display descriptions for all commands matching a glob:
# whatis --wildcard net*
4. Search man page descriptions with a regular expression:
# whatis --regex 'wish[0-9]\.[0-9]'