apropos
Search manual pages by keyword
TLDR
Search for a keyword using a regex
Search without restricting the output to the terminal width ([l]ong output)
Search for pages that match all the regex given
SYNOPSIS
apropos [-alrtw] [-s section] [-m system] [-M path] [-P pager] [--jaro-winkler] [--levenshtein] [-e | -r] expression...
apropos [-d] [-v] [--help] [--version]
PARAMETERS
-a, --and
Require all supplied expressions to match (AND logic).
-d, --debug
Print debugging information.
-e, --exact
Perform an exact match; do not use wildcards.
-h, --help
Display a help message and exit.
--jaro-winkler
Use Jaro-Winkler distance for fuzzy matching (requires man-db 2.10.0+).
-l, --long-output
Do not truncate the output, show full description lines.
--levenshtein
Use Levenshtein distance for fuzzy matching (requires man-db 2.10.0+).
-m <system>, --system=<system>
Search manual pages from another specified hierarchy.
-M <path>, --path=<path>
Specify the search path for manual pages directly.
-P <pager>, --pager=<pager>
Use the specified pager program to display the output.
-r, --regex
Interpret the search expression as a regular expression.
-s <list>, --section=<list>
Search only in the specified manual sections (e.g., '1,8').
-t, --troff
Don't use nroff to format the output. Useful for programmatic parsing.
-v, --verbose
Print verbose warnings.
--version
Display version information and exit.
-w, --word
Match only on word boundaries, preventing partial word matches.
DESCRIPTION
apropos (which is equivalent to man -k) is a fundamental utility for searching system manual pages. When you are uncertain about the exact name of a command, function, or concept, apropos helps you discover relevant man pages by searching their names and the brief descriptions found in their NAME sections. It operates by querying a pre-built database, typically maintained by mandb, which ensures fast and efficient lookups. By default, the search is case-insensitive and matches substrings, but it offers options for exact matching, regular expressions, or word boundary searches. This command is an invaluable tool for exploring the vast array of commands and functions available on Unix-like operating systems, making it easier to find utilities related to a specific task or topic.
CAVEATS
apropos relies on a pre-built and up-to-date database of man page summaries. If this database (managed by mandb) is stale or corrupted, apropos may not find new man pages or provide incomplete results. It only searches the brief descriptions in the NAME section, not the full content of manual pages. Fuzzy matching options (--jaro-winkler, --levenshtein) are relatively recent additions and might not be available on older system versions.
DATABASE REQUIREMENT
For apropos to function correctly and provide up-to-date results, the underlying whatis or man-db database must be periodically refreshed. This database is typically updated by the mandb command (or makewhatis on older systems), which often runs as a scheduled cron job. If you install new software and apropos doesn't find its man pages, you might need to manually run sudo mandb to update the database.
SEARCH LOGIC AND EXPRESSIONS
By default, apropos treats multiple expression arguments as an 'OR' operation, meaning it will return results if any of the expressions match. The -a (--and) option changes this to an 'AND' operation, requiring all expressions to match. The search itself is case-insensitive and matches substrings by default. However, options like -e (exact match), -r (regular expression), and -w (word boundary) allow users to refine their search patterns for more precise results.
HISTORY
The apropos command has been a staple of Unix-like operating systems for decades, providing a crucial indexing and search capability for manual pages. It's historically equivalent to man -k. Its operation relies on a database of man page summaries, which on modern Linux systems is typically managed by the man-db project. This project aimed to provide a more robust and flexible manual page system compared to older implementations. Recent developments include the addition of fuzzy matching algorithms like Jaro-Winkler and Levenshtein distances, reflecting ongoing efforts to enhance user experience and search accuracy.