Find the Right Linux Manual Page with apropos

You remember what a tool does but not what Linux calls it, and apropos searches every manual page description until it finds a match. This guide gets you searching it confidently in about ten minutes. The examples use apropos from man-db 2.12.0, installed here as package version 2.12.0-4build2. You need a shell and the man-db tools; none of the searches below need elevated privileges.

1. Check the installed command

Confirm the command is available and see its version. This is a read-only check:

$ command -v apropos
/usr/bin/apropos
$ apropos --version
apropos 2.12.0

apropos searches manual page names and their short descriptions, not every paragraph of the page itself. A phrase buried only in the detailed text will not turn up here.

Checkpoint: if command -v prints nothing, install the man-db package through your distribution's normal package manager. Do not reach for sudo merely to run a search.

2. Search for a topic

Pass one or more keywords. By default each keyword is treated as a regular expression, and a result can match any of them. Quote a search containing punctuation or shell metacharacters:

$ apropos 'network namespace'
ip-netns (8)         - process network namespace management
network_namespaces (7) - overview of Linux network namespaces

The output format is name (section) - description. The section number is a useful clue: section 1 normally holds commands, section 5 commonly holds file formats and configuration files. The exact results and their order depend on the manual pages installed on your machine.

A broad result list is not a failure. It just means the words matched several descriptions. Start with the distinctive part of the task, then narrow it in the next step.

3. Require all keywords

Use -a, also written --and, when a result must match every supplied keyword. This helps when a general word such as file produces too much noise:

$ apropos -a file permissions
access (2)           - check user's permissions for a file
chmod (2)            - change permissions of a file
eaccess (3)          - check effective user's permissions for a file

Without -a, apropos matches an item against any keyword, which is easy to miss when you expected a phrase search. Two words are not automatically treated as one literal phrase, so use a tighter regular expression or the exact and wildcard modes below when that distinction matters.

4. Choose the matching rule deliberately

The default regular-expression mode, -r, can match any part of a page name or description. It is useful for controlled alternatives, but characters such as ., *, ?, ^ and $ have special meanings, so quote the expression so the shell leaves it alone.

Use -e or --exact when the keyword must match a page name or description exactly:

$ apropos -e passwd
passwd (1)           - change user password
passwd (1ssl)        - OpenSSL application commands
passwd (5)           - the password file

Exact matching does not mean only one result appears. Several manual pages can share the same name in different sections, and a description can also be an exact match.

Use -w or --wildcard for shell-style wildcards such as * and ?, and quote the pattern. Combine -w with -e and an expanded pattern must match the entire page name or description, not just a word boundary.

5. Limit the manual sections

Looking for a command rather than a library interface? Restrict the search with -s, whose argument is a colon- or comma-separated list:

$ apropos -s 1 'manual page'
apropos (1)          - search the manual page names and descriptions
clang-apply-replacements-20 (1) - manual page for clang-apply-replacements 20
clang-check-20 (1)   - manual page for clang-check 20

A simple section such as 3 includes related extensions such as 3perl and 3x. If you need only an exact section extension, include it, for example 3perl. Use -s 1 to cut the distraction from similarly named library or configuration pages, then run man NAME on the result you want to inspect.

6. Make long descriptions readable

apropos trims output to the terminal width by default, which can hide the end of a description in a narrow terminal. Use -l or --long when the full line matters:

$ apropos --long -s 1 password

Output will vary with the pages installed. If you are scripting a search, do not parse display spacing as a stable interface. Treat the name, section and description as human-facing output and verify the page you picked with man.

7. Diagnose an empty or surprising result

No match is reported with the message nothing appropriate, and the command exits with status 16:

$ apropos 'definitely-no-apropos-match-zzzz'
definitely-no-apropos-match-zzzz: nothing appropriate.
$ printf 'status=%s\n' "$?"
status=16

Tip: status 16 means nothing matched the criteria, which is different from a usage or configuration error (status 1) or an operational error (status 2). In a script, treat 16 as an empty search result rather than automatic proof of a broken apropos installation.

Try a shorter or more distinctive term, remove an accidental regular-expression operator, or search without -s once to see whether the page exists in another section. Then inspect a candidate directly:

$ man -f NAME
$ man NAME

Replace NAME with the page name from apropos. man -f asks for the short description, while man opens the full page.

8. Understand the search database

apropos searches an index maintained by mandb. Depending on the installation, that index may be refreshed by a scheduled job or may need manual updating after new manual pages are installed. If you have just installed a package and its page is missing, first confirm the page file exists, then check the system's man-db maintenance process.

Warning: updating a system-wide index changes shared state and may require elevated privileges. Do not run sudo mandb as a reflex: check your distribution's package-management and man-db guidance first. If you maintain a separate manual hierarchy, apropos can search it with -M PATH, where PATH is a colon-delimited list that overrides MANPATH for that one invocation.

Similarly, MANPATH controls the manual hierarchies searched when it is set, and an unexpected value can hide normal system pages. Inspect it without changing anything:

$ printf 'MANPATH=%s\n' "${MANPATH-}"

Unset or empty values allow apropos to derive an appropriate path from PATH, according to the installed man-db configuration.

Done means