man
Display command manual pages
TLDR
Display the man page for a command
Open the man page for a command in a browser (BROWSER environment variable can replace =browser_name)
Display the man page for a command from section 7
List all available sections for a command
Display the path searched for manpages
Display the location of a manpage rather than the manpage itself
Display the man page using a specific locale
Search for manpages containing a search string
SYNOPSIS
man [SECTION] NAME...
man -k|--apropos KEYWORD...
man -f|--whatis NAME...
PARAMETERS
-k, --apropos KEYWORD...
Searches the manual page names and their short descriptions for the specified KEYWORD, similar to the apropos(1) command. Useful when you know what you want to do but not the exact command name.
-f, --whatis NAME...
Displays a very concise one-line description from the manual page for the given NAME, similar to the whatis(1) command.
-a, --all
By default, man will exit after displaying the first manual page it finds. This option forces man to display all manual pages matching the specified NAME, one after another.
-w, --where, --path
Does not display the manual page but prints the location (path) where the manual page would be found.
-S SECTION_LIST, --sections SECTION_LIST
Limits the search to the specified manual sections. SECTION_LIST is a colon-separated list of section numbers or names, e.g., -S 1:8:2. The sections are searched in the given order.
-L LOCALE, --locale LOCALE
Sets the locale to be used for the manual pages. This overrides the default locale determined by environment variables like LC_ALL, LC_MESSAGES, or LANG.
-P PAGER, --pager PAGER
Specifies the pager program to use to display the manual page instead of the default (usually less or more). For example, -P cat would dump the page to standard output.
DESCRIPTION
The man command is the primary utility for viewing the system's reference manuals, commonly known as man pages. It provides on-demand documentation for commands, system calls, library functions, configuration files, and various other topics. When invoked, man typically searches through a predefined set of directories (the manpath) for the requested page. If found, it displays the content using a pager program, usually less, allowing users to scroll, search, and navigate the text. Man pages are organized into numbered sections, with each section representing a different category of documentation, such as user commands (section 1), system calls (section 2), or file formats (section 5). This hierarchical organization helps users quickly locate the relevant documentation.
CAVEATS
The availability of man pages depends on installed documentation packages. If a man page is not found, it might mean the corresponding package or its documentation component is not installed. Incorrect MANPATH environment variable or outdated man database (created by mandb) can lead to pages not being found or not being updated correctly.
MANUAL SECTIONS
Man pages are typically organized into numbered sections, representing different categories of documentation:
1: Executable programs or shell commands
2: System calls (functions provided by the kernel)
3: Library calls (functions within program libraries)
4: Special files (devices, /proc, /sys)
5: File formats and conventions (e.g., /etc/passwd)
6: Games
7: Miscellaneous (macros, conventions, standards)
8: System administration commands and daemons
9: Kernel routines (non-standard)
ENVIRONMENT VARIABLES
man's behavior can be influenced by several environment variables:
MANPATH: Specifies the search path for manual pages. If unset, a default path is used.
PAGER: Specifies the pager program to use. Overrides the default pager but can be overridden by -P.
MANOPT: Provides default command line options for man.
LC_ALL, LC_MESSAGES, LANG: Determine the locale for displaying localized manual pages.
HISTORY
The concept of manual pages originated with early Unix systems, with the first version being created in 1971 for AT&T Unix. The man command has been a fundamental part of Unix-like operating systems ever since, providing essential system documentation. Its design has remained remarkably consistent, although implementations have evolved to support features like compression, internationalization, and different pager options.