Linux provides many commands and configuration files. How can we view the usage of these commands and configuration files? The commands and help documentation provided by Linux come with their own help documentation to explain the usage of commands and the format of configuration files. At the same time, Linux provides the
<span>man</span>
command to view these help documents.
Below is an introduction to the basic knowledge of the <span>man</span>
command.
Using man to View Help Documentation
To use <span>man</span>
to view help documentation, the usage is very simple. For example, for <span>passwd</span>
, there are passwd(1)/passwd(5), etc. To view the corresponding help documentation, the method is as follows 💻️
# View the help documentation for passwd(1)
man 1 passwd
# View the help documentation for passwd(5)
man 5 passwd
Enter the corresponding number to view the corresponding documentation.
Meaning of man Numbers
<span>man</span>
uses numbers with the following meanings 🗒️
Number | Description |
1 | Executable programs or shell commands |
2 | System calls (functions provided by the kernel) |
3 | Library calls (functions in libraries) |
4 | Special files (usually found in /dev) |
5 | File formats and conventions, e.g., /etc/passwd |
6 | Games |
7 | Miscellaneous (including macros and conventions), e.g., man(7), groff(7) |
8 | System administration commands (usually only for root users) |
9 | Kernel routines [non-standard] |
To see more documentation, you can use <span>man man</span>
to view. The above <span>1</span>
/<span>5</span>
/<span>8</span>
are frequently used.
Main Sections of man Help Documentation
The documents viewed through man generally contain the following sections 🗒️
Section | Description |
NAME | Brief description of the command or data name |
SYNOPSIS | Concise syntax of the command |
DESCRIPTION | More complete explanation, needs careful reading |
OPTIONS | Description of command line options |
COMMANDS | Commands that can be executed within this program when it is running |
EXIT STATUS | Exit code of the program |
ENVIRONMENT | Environment variables of the program |
FILES | Some files used, referenced, or linked to by this program or data |
SEE ALSO | Other documentation related to this command or data |
EXAMPLES | Examples for reference |
Searching Methods When Viewing man Documentation
When viewing help documentation through the <span>man</span>
command, you can use the following keys to view and search for specific content in the documentation 🗒️
Key | Description |
PageDown | Scroll down one page |
PageUp | Scroll up one page |
Home | Jump to the first page |
End | Jump to the last page |
/string | Search down for the string |
?string | Search up for the string |
n,N | When searching with / or ?, n finds the next, N finds the previous |
q | Exit man documentation view |
<span>man</span>
help documentation is generally located in the <span>/usr/share/man</span>
directory, and the configuration file for <span>man</span>
is <span>/etc/man_db.conf</span>