Linux Command Reference ยท System Information
Linux apropos command
Reference for the Linux apropos and whatis commands: find commands by keyword in manual page descriptions, use regex and exact modes, and rebuild the database.
When you know what you want to do but not which command does it, apropos helps. It searches the one-line descriptions of all installed manual pages for a keyword and prints the matching page names with those descriptions. man -k is the same command.
Its sibling whatis goes the other way: you give it a command name and it prints that page's one-line description. Both rely on a small database built by mandb, and both are missing (like man itself) on minimal systems and containers. The examples below therefore model the idea on plain text.
apropos [-e | -r | -w] [-s SECTION] KEYWORD... whatis NAME...
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
apropos [OPTION]... KEYWORD...
| Option | Description |
|---|---|
KEYWORD |
Matched as a case-insensitive regular expression against names and descriptions (default). |
-e, --exact |
The keyword must match the whole name or description word exactly. |
-w, --wildcard |
Treat the keyword as a shell-style pattern (rm*). |
-r, --regex |
Treat the keyword as a regular expression (the default for most versions). |
-a, --and |
With several keywords, show only pages that match all of them (default: any). |
-s LIST, --sections=LIST |
Limit to manual sections, e.g. -s 1,8. |
-l, --long |
Do not trim output to the terminal width. |
whatis NAME prints the description of pages whose name is exactly NAME.
Returns: 0 if something matched; 16 if nothing matched (xyz: nothing appropriate.).
Usage notes
- Database required. The first result after installing may be "nothing appropriate" until
sudo mandbhas run. Fix it, or search the pages directly withman -k. - Wide searches are noisy:
apropos copyreturns dozens of results. Narrow with-s 1(user commands) or-awith a second word, and filter withgrep. - Names with sections: results look like
cp (1). Use the section to open the right page:man 1 cp. - Only installed pages are searched. Pages for programs not installed on this machine are not in the database.
- Substring surprises: by default
apropos passalso matches "password", "bypass" and "passwd". Add-wor-eto be strict. - Scripting: the output format is human oriented. For existence checks use
command -vortype, notapropos. - Alternatives:
man -k,help | grep, searching your package manager (apt search,dnf search), or a web search for tasks no installed page describes.
Related
man,infoandhelp,type,grep- Lessons: Getting help, grep