The man
(manual) command is used to display the user manual of any command or utility available on a Linux system. Each manual entry provides detailed information about the command, including its usage, options, and examples.
-
Syntax:
man [options] [command]
-
Examples:
man ls
- Displays the manual page for the
ls
command.
man -k "file management"
- Searches the manual page names and descriptions for the keyword "file management."
man 5 passwd
- Displays the manual page from section 5 (file formats) for the
passwd
file.
- Displays the manual page for the
-
-k [keyword]
or--apropos [keyword]
:- Searches for a keyword in all manual pages.
man -k network
- Lists all manual pages that mention "network."
-
-f [command]
or--whatis [command]
:- Displays a brief description of the specified command.
man -f tar
- Shows a brief description of the
tar
command.
-
-a [command]
:- Displays all available manual pages for the specified command, one after another.
man -a intro
- Displays all manual pages for
intro
from different sections.
-
-s [section] [command]
:- Displays the manual page from the specified section.
man -s 2 chmod
- Displays the manual page for
chmod
from section 2 (system calls).
-
--help
:- Displays help information about the
man
command itself.
man --help
- Shows usage information and options for
man
.
- Displays help information about the
Section | Description |
---|---|
1 | User commands (executable programs) |
2 | System calls (kernel functions) |
3 | Library functions (programming libraries) |
4 | Special files (usually in /dev ) |
5 | File formats and conventions |
6 | Games and screensavers |
7 | Miscellaneous (including macro packages) |
8 | System administration commands |
9 | Kernel routines (non-standard) |
-
Navigating in
man
:- Use the arrow keys or
j/k
to scroll up and down. - Press
/
to search within the manual page. - Press
q
to quit the manual page.
- Use the arrow keys or
-
Finding Related Commands:
- Use
man -k [keyword]
to find commands related to a specific keyword.
man -k directory
- Lists all commands related to directories.
- Use
-
Viewing Other Sections:
- If a command has entries in multiple sections, specify the section number to view a particular one.
man 3 printf
- Views the library function version of
printf
(section 3).
The man
command is an essential tool for learning about and mastering commands in Linux. It provides detailed documentation on virtually every command and utility, including their options, usage, and examples. Knowing how to effectively use man
will greatly enhance your ability to work with Linux systems.