Modern Linux operating systems ship with thousands of command-line utilities, system calls, configuration formats, and administrative daemons. While the traditional man command provides exhaustive documentation for a known utility, it offers little assistance when you cannot recall the exact name of the tool you need. The built-in apropos and whatis utilities solve this problem by querying the system’s indexed manual page summary database, enabling you to discover the right Linux command using ordinary keywords and descriptions.
Understanding whatis Versus apropos
Both utilities search the whatis database—an index generated from the NAME section of every installed manual page—but they serve distinct investigative purposes:
- whatis: Performs an exact name lookup. It accepts a specific command name (such as
greportar) and displays a concise, single-line description of what that utility does along with its manual section number. - apropos: Performs a broad keyword search (equivalent to running
man -k). It scans the descriptions of all manual pages for your search terms, helping you discover relevant commands when you only know what task you want to accomplish.
Understanding Manual Section Numbers
When reviewing results from either command, each utility name is followed by a number in parentheses. These indicate the POSIX manual architecture sections:
| Section Number | Documentation Scope | Typical Examples |
|---|---|---|
| 1 | General User Commands and Executables | ls, grep, tar |
| 2 | System Calls (Kernel Functions) | fork, open, read |
| 3 | C Library Functions | printf, malloc |
| 4 | Special Files (Devices in /dev) |
null, zero, random |
| 5 | File Formats and Configuration Conventions | /etc/passwd, fstab |
| 7 | Overview, Miscellaneous, and Standards | regex, hier |
| 8 | System Administration and Root Daemons | fdisk, systemd, iptables |
How to Search Commands by Keyword Using apropos
To find commands capable of performing a specific operation, pass the functional keyword to apropos:
apropos partition
The shell outputs all utilities whose descriptions contain the word “partition”, including fdisk(8), parted(8), gdisk(8), and sfdisk(8).
Searching Multiple Keywords with Boolean Logic
By default, if you specify multiple words, apropos displays matches containing any of the terms. To narrow your search to commands matching all specified keywords, use the -a (and) flag:
apropos -a network interface
Filtering by Specific Manual Sections
If you only want user-executable commands and want to exclude programming library functions or kernel calls, restrict the query using the -s (section) flag:
apropos -s 1 compress
This filters results to section 1 utilities like gzip, bzip2, xz, and zip, omitting section 3 development headers.
Using Regular Expressions
For advanced pattern searching, apropos supports full POSIX regular expressions via the -r flag:
apropos -r '^zip'
This pattern confines results exclusively to commands whose names begin with “zip”.
How to Retrieve Quick Command Summaries Using whatis
When you know a command’s name but want an instant reminder of its core functionality without wading through a multi-page manual, use whatis:
whatis rsync curl chmod
Output appears cleanly formatted in single-line summaries:
rsync (1) - a fast, versatile, remote (and local) file-copying tool
curl (1) - transfer a URL
chmod (1) - change file mode bits
Fixing the “nothing appropriate” Error with mandb
On freshly installed minimal Linux distributions, container images, or after installing newly compiled software packages, running apropos may return the frustrating message:
apropos: nothing appropriate.
This occurs when the pre-compiled index database used by man-db is missing or outdated. You can initialise and rebuild the manual cache database by running:
sudo mandb
The command will scan all system manual directories (typically /usr/share/man and /usr/local/man), purge obsolete references, and build an optimised search database. Once complete, both apropos and whatis will immediately return comprehensive results.