Linux man Command: Read Command Manual Pages
man is a command used in Linux systems to read documentation for installed commands, configuration files, system calls, library functions, and other items directly in the terminal. By default, executing man command allows you to check usage, options, exit status, and related documents.
Since examples found on the Internet may differ from the version on the current system, it is a good habit to check the manual page (man page) installed on your system before performing any actual tasks. This article explains everything from how to open the manual, selecting sections, searching by keywords, checking shell built-in commands, to troubleshooting.
What is the man command?
man is an interface that displays system reference manuals. When given a page name as an argument, it searches the configured paths for the manual, formats it, and displays it one screen at a time. Generally, less is used as the pager to display the screen, but this can vary depending on system settings and the MANPAGER or PAGER environment variables.
Manual pages are not provided by a single man program. Each command or library package installs its own documentation, so the pages available can differ depending on the installed packages and versions, even on the same distribution.
Basic syntax and first example
The most commonly used syntax is as follows. Square brackets mean optional items, so do not enter them in the actual command.
man [options] [[section] page...]
To open the manual for the ls command, execute it as follows.
man ls
If you want to open the page of a specific section, specify the section number before the page name.
man 5 passwd
The above command opens the page of section 5, which explains the /etc/passwd file format, not the passwd command. If you omit the section like man passwd, it searches in a predefined order and shows only the first page found.
How to navigate and search in the manual screen
The following keys are generally available when the pager is less. If a different pager is set, key operations may vary.
| Key | Action |
|---|---|
Space, Page Down |
Move to the next screen. |
b, Page Up |
Move to the previous screen. |
↑, ↓ |
Move up or down one line at a time. |
g |
Move to the beginning of the document. |
G |
Move to the end of the document. |
/string |
Search for a string downward from the current position. |
?string |
Search for a string upward from the current position. |
n, N |
Move to the next search result or the previous search result. |
h |
Open the pager's help. |
q |
Exit the manual. |
For example, if you open man ls and then type /-a and press Enter, you can find the location where -a appears. Short options can match other words in the text, so if necessary, it is faster to search for long option names or key words in the description, like --all.
Reading the structure of a manual page
Not every item exists on every page, but a typical command manual is organized into the following sections.
| Section | Content |
|---|---|
NAME |
Summarizes the page name and function in one line. |
SYNOPSIS |
Shows the usage format of commands or functions. |
DESCRIPTION |
Explains in detail how it works and its intended purpose. |
OPTIONS |
Describes the available options and the effect of each option. |
EXIT STATUS |
Explains the exit status that distinguishes normal termination from errors. |
ENVIRONMENT |
Describes environment variables that affect operation. |
FILES |
Shows related configuration files, data files, and their paths. |
EXAMPLES |
Provides actual usage examples. May not be available on every page. |
SEE ALSO |
Guides to other manual pages that are good to read together. |
SYNOPSIS also emphasizes the importance of notation. Text in bold usually represents entries that should be typed as-is, while italicized text generally indicates values that the user should replace. [ ] denotes optional items, and ... signifies repeatable items. However, the representation may vary depending on the page formatting and output environment, so you should also read the explanation on the respective page.
Meaning of manual section numbers
Linux manuals are divided into sections according to the nature of the document. Since pages with the same name can exist in multiple sections, it is good to know the section number to find the desired document without errors.
| Section | Classification | Example |
|---|---|---|
| 1 | Executable programs and shell commands | ls(1), grep(1) |
| 2 | System calls | open(2), read(2) |
| 3 | Library Calls | printf(3), malloc(3) |
| 4 | Special Files and Devices | null(4), Device Interface |
| 5 | File Formats and Conventions | passwd(5), fstab(5) |
| 6 | Games | Manuals of Installed Games |
| 7 | Other Topics and Conventions | signal(7), man-pages(7) |
| 8 | System Management Commands | mount(8), useradd(8) |
| 9 | Kernel Routine | This is a non-standard section and may not exist on all systems |
In the documentation, you may see a number after a name like passwd(1) or passwd(5). This number is not a version but a manual section. Each can be opened as follows.
man 1 passwd man 5 passwd
How to find pages with the same name
Check all matching sections
-a shows all pages found in the search order one by one. After exiting the first page, the detailed behavior, such as asking whether to open the next page or immediately displaying the next document, may vary depending on the implementation and settings.
man -a passwd
-f outputs the page name and a short description. Usually used for purposes like whatis.
man -f passwd whatis passwd
Open only a specific section
If you know the section you want, specifying the number is the most accurate. In addition to the space-separated format, some man implementations support formats like passwd.5 or the quoted 'passwd(5)'.
man 5 passwd man passwd.5 man 'passwd(5)'
If you prioritize portability, using the widely understood and easy-to-understand format man 5 passwd is a safe choice.
How to search by keyword when you don't know the name
Searching by name and short description
man -k searches for keywords in the names and short descriptions of manual pages. apropos is also used for the same purpose.
man -k "copy files" apropos "copy files"
Since search terms can be treated as regular expressions, if they include special characters, you need to consider both the shell and the search rules. For simple phrases, it is safer to enclose them in quotes, as in the examples above.
Searching the entire manual text
-K searches for strings in the manual body, not in the name or summary. If there are many installed documents, it can take a long time, so it's better to first search with -k and use -K only when necessary.
man -K "environment variable"
Narrowing the range to a specific section can reduce search time.
man -K 5 "password database"
Frequently Used man Options
The options below are organized based on the man-db implementation widely used in Linux. Since support and meaning may differ in other operating systems or implementations, the most accurate way to check is to use man man for the description on the current system.
| Option | Description |
|---|---|
-a, --all |
Displays all manual pages that match the name. |
-f, --whatis |
Prints the page name and a brief description. |
-k, --apropos |
Searches for keywords in names and brief descriptions. |
-K, --global-apropos |
Searches for strings in the body of all manual pages. |
-w, --where |
Displays the location of the original manual file without opening the page. |
-l, --local-file |
Displays the specified local manual file instead of the search path. |
-L locale, --locale=locale |
Specifies the locale to use in that execution. |
-M path, --manpath=path |
Directly specifies the path where the manual pages will be searched. |
For example, you can check the actual location of the ls manual file you are reading as follows.
man -w ls
Use the help command for shell built-in commands as well
Built-in commands that the shell executes itself, like cd, alias, read, may not have a separate executable file. In Bash, it is better to first check the type of the command with type, and if it is a built-in command, using help is more accurate and faster.
type cd help cd help -m cd
help -m displays the help in a format similar to the manual page. You can check a detailed explanation of Bash as follows.
man bash
The same name can exist simultaneously as an alias, a function, a shell builtin command, and an external program, so if you are not sure what is actually executed, check them all with type -a name.
type -a printf
Check localized manuals and the locale
man can display the document in the current locale first if a translated page is installed. You can check the current locale with the following command.
locale echo "$LANG"
If you want to temporarily view the English original, you can use the -L option.
man -L C ls
Even if a matching locale is set, if a translated page is not installed or there is no translation for the document, the English page may be displayed. Since translations may be updated later than the original, it is recommended to check the English original and the program version when the options or behavior are suspicious.
How to handle when a manual page is not available
Check whether the command and related packages are installed
If No manual entry for... appears, it may be because the page name is incorrect, or the command or documentation package is not installed. First, check whether the command exists and what kind it is.
type -a command command -v command
Minimal installation images or containers may not have the man program and basic manuals. On Debian/Ubuntu and Rocky Linux/RHEL systems, the following packages are generally installed.
sudo apt update sudo apt install man-db manpages
sudo dnf install man-db man-pages
Package names and repository configuration may vary depending on the distribution and version. Documentation for specific programs may be included in the program package or separate documentation/development packages, so it is also useful to use the distribution's package search feature.
Checking search databases and paths
If the man command opens but man -k or whatis return no results, the index database may not have been created yet. In a man-db environment, you can update the database with administrative privileges.
sudo mandb
You can check the manual search path with manpath. If the user sets MANPATH directly, the default search path may change, so it is generally better to avoid fixing it without particular reason.
manpath printf '%s\n' "$MANPATH"
Practical useful usage examples
Quickly finding options
After opening the manual, you can quickly find the necessary options in long documents by using the search key.
man tar
Type /--exclude on the screen and press Enter, then move between the search results using n and N.
Checking the configuration file format
Before modifying the configuration file, check if there are relevant pages in Section 5. The meanings of fields, allowable values, comment rules, and examples may be explained.
man 5 fstab man 5 ssh_config man 5 sshd_config
Investigating by following related documents
If you could not find the answer on one page, check SEE ALSO at the end of the document. Related commands, configuration files, system calls, and conceptual documents are linked in the name(section) format, allowing you to systematically broaden your search scope.
man 2 open man 7 path_resolution
How do man, --help, and info differ?
| Method | Suitable situations | Features |
|---|---|---|
command --help |
When you want to quickly skim the syntax and options | Good for brief and immediate checks, but some unsupported commands exist |
man command |
When you want to see detailed documentation related to option meanings, files, and environment variables | Provides reference documents installed on the current system |
info command |
When you want to read GNU program chapters and examples in depth | It is a hypertext structure and requires a separate Info document. |
help command |
When checking Bash built-in commands | Shows the help for built-in commands provided by the current Bash |
Instead of sticking to just one, it is efficient to first check the syntax with --help, read detailed behavior in man, and use help together for shell built-in commands.
Frequently Asked Questions
Is the number after man the version?
No. The numbers in printf(1) and printf(3) indicate manual sections. Section 1 covers user commands, and section 3 covers library functions, so even if the names are the same, they are different documents.
How do you exit the manual?
If the default pager is less, press q. If it does not exit, check the help or settings of the pager you are currently using.
Why is the content of the man page different from online documents?
The local manual is provided by the packages installed on the current system, so it can vary depending on the distribution, package version, and installation status. On the other hand, online documents may describe a newer version or a different implementation. For the options to use on an actual server, it is safest to check the local manual and command --version.
What if you don’t know the command name at all?
Search for the name and a short description using man -k keyword or apropos keyword. If the search results are too many, add more specific words or limit the section range in environments that support the -s option.
Summary
man is the most basic tool to check reference documents installed on the current Linux system. Rather than just remembering man command, if you also learn section numbers, -k search, -f summary, -w path check, and pager search together, you can find the information you need much faster.
First, run man man to check the options provided by the man implementation on your system. Using the shell built-in command help, short option check --help, and long description of GNU programs info together can reduce gaps in document navigation.









