man Command Cheat Sheet
The man (manual) command is the system's interface to its reference manuals. It is the first place to look for help.
Synopsis
man [SECTION] PAGE...
Basic Navigation
Open manual for ls:
man ls
Shortcuts (Inside man)
Based on less shortcuts.
| Key | Action |
|---|---|
Space |
Next Page |
b |
Previous Page |
Enter |
Next Line |
/term |
Search forward for "term" |
?term |
Search backward for "term" |
n |
Next search match |
N |
Previous search match |
q |
Quit |
h |
Help (shortcuts) |
Manual Sections
The manual is divided into 8 main sections. Specifying a section helps when names collide (e.g., printf command vs printf C function).
| # | Description | Example |
|---|---|---|
| 1 | User Commands | man 1 ls |
| 2 | System Calls (Kernel) | man 2 open |
| 3 | Library Functions (C) | man 3 printf |
| 4 | Devices / Special Files | man 4 null |
| 5 | File Formats / Configs | man 5 passwd |
| 6 | Games | man 6 intro |
| 7 | Miscellaneous | man 7 regex |
| 8 | Sysadmin Commands | man 8 mount |
Example:
To see the format of /etc/passwd file (Section 5), not the command passwd (Section 1):
man 5 passwd
Searching Manuals
Search by Keyword (-k)
Equivalent to apropos. Searches titles and descriptions.
man -k "network"
man -k "^tcp"
Find Location of Man Page (-w)
Don't open it, just tell me where the file is.
man -w ls
# Output: /usr/share/man/man1/ls.1.gz
Browser Mode (-H)
Open man page in a browser (if configured).
man -Hfirefox ls
Notes
- MANPAGER: Set this environment variable to change the viewer (e.g.,
export MANPAGER="vim -M -"). - Structure:
- NAME: Name and one-line description.
- SYNOPSIS: Syntax.
- DESCRIPTION: Full details.
- OPTIONS: Flags.
- FILES: Related configuration files.
- SEE ALSO: Related commands (useful for discovery).