man Command Guide
man (short for “manual”) displays the user documentation for a
command, a configuration file format, or a system call. It’s the built-in
documentation browser of Linux: nearly every command you install ships with
a man page, and man is how you read it.
What is man, and Why Use It?
You’ve just learned about tar. You want to know exactly what --exclude
does, whether it accepts multiple patterns, and what happens with trailing
slashes. You could search the web — or you could type:
man tar
and get the authoritative documentation written by the people who built the
tool, matching the exact version installed on your system. Man pages cover
commands, file formats (/etc/passwd), library functions, and even games.
They’re the first place to look whenever a tool does something surprising.
Reading a Man Page
A man page opens in a pager (usually less):
man ls
Inside the pager:
| Key | Action |
|---|---|
Space | Scroll down one page |
b | Scroll up one page |
/pattern | Search forward |
n / N | Next / previous search hit |
G / g | Jump to end / start |
q | Quit |
If you already know less, you already know man — see the
less page for the full keybinding set.
Man Sections: The Same Name Means Different Things
Man pages are grouped into numbered sections, and the same word can have several:
man 1 printf # the printf command
man 3 printf # the C library printf() function
man 5 passwd # the /etc/passwd file format
man 8 ifconfig # a system administration command
Section conventions:
| Section | Contents |
|---|---|
| 1 | User commands (the everyday ones) |
| 2 | System calls (kernel functions) |
| 3 | Library functions (C library, etc.) |
| 5 | File formats and conventions |
| 8 | System administration commands |
If man printf shows you something confusing, you probably landed in the
C library section — add the section number to disambiguate.
Searching Across All Manuals
Forgot the command name? Search every manual page’s short description:
# Search descriptions for the keyword "copy"
man -k copy
# One-line description of a specific command
man -f ls
# ls, ls1 (1) - list directory contents
man -k and man -f are also available as the standalone commands
apropos and whatis. Both rely on a prebuilt database; if searches come
up empty, see the pitfalls below.
Searching Inside a Man Page
You don’t have to read the whole page — pipe it to grep to jump straight to what you need:
# Find every mention of "color" in the ls manual
man ls | grep -i color
# Show the OPTIONS section and everything after it
man tar | sed -n '/OPTIONS/,$p'
Or just search inside the pager with /pattern, as shown above.
man in Daily Life
A realistic discovery flow:
# Hear about a flag you don't recognize
man df | grep -i filesystem
# Check the exact syntax of a config file format
man 5 fstab
# Find a command that does X
man -k "disk usage"
Common Pitfalls
man: command not found. Minimal containers and slim installs often omit the man pages. Install theman-dbpackage (Debian/Ubuntu) orman-db/man(Fedora/Arch) — see the packages section.- Stale search database.
man -kandwhatisuse a prebuilt index. After installing software, refresh it withmandb(ormakewhatison some systems) before trusting empty results. - Section surprises.
man printf,man kill, orman echomay show the C library or file-format page instead of the command. Useman 1 ...to force the command section. - Ctrl-S freezes your terminal. In the pager, Ctrl-S is flow control —
it looks like a hang. Press Ctrl-Q to unfreeze. (It also disables the
feature permanently for your shell session with
stty -ixon.) - Man pages describe the installed version. If your docs mention a flag
your build doesn’t have, check
command --version— you may be on an older release.
Related Pages
- info — the GNU hyperlinked alternative to man
- less — the pager man uses underneath
- grep — search within manual pages
- type — check what a command name is before reading its docs
- which — find the executable a man page describes
Cheatsheet
| Command | What it does |
|---|---|
man ls | Read the manual for ls |
man 5 passwd | Read a specific man section |
man -k copy | Search all manual descriptions |
man -f ls | One-line description of ls |
man ls | grep -i color | Search inside a page |
/pattern then n | Search forward inside the pager |
q | Quit the pager |
mandb | Rebuild the whatis/apropos database |