What Are Man Pages?#
Man pages (manual pages) are the built-in documentation system on Linux. Nearly every command, system call, library function, and configuration file has a man page explaining what it does, how to use it, and what options it accepts.
When you don’t know how a command works — or you know the command but forgot a specific flag — the man page is where you look first. It’s available offline, on any system, without a browser.
man lsThat opens the full manual entry for ls. You’re now reading documentation written by the people who built the tool.
Opening and Navigating Man Pages#
Man pages open in a pager — usually less. If you’ve used less before (or Vim), the navigation will feel familiar:
| Key | Action |
|---|---|
Space / f | Page down |
b | Page up |
j / k | Scroll down / up one line |
/pattern | Search forward |
?pattern | Search backward |
n | Next search result |
N | Previous search result |
q | Quit |
g | Go to beginning |
G | Go to end |
Searching within a man page#
If you’re looking for a specific option, search for it:
/--recursiveThis jumps to the first occurrence. Press n to cycle through matches.
Man Page Sections#
Man pages are organized into numbered sections. This matters because the same name can exist in multiple sections with completely different meanings.
| Section | Contents | Example |
|---|---|---|
| 1 | User commands | ls, grep, git |
| 2 | System calls | open, read, fork |
| 3 | Library functions | printf, malloc, strlen |
| 4 | Special files and devices | /dev/null, /dev/random |
| 5 | File formats and config files | passwd, crontab, fstab |
| 6 | Games | fortune, cowsay |
| 7 | Miscellaneous | ascii, regex, signal |
| 8 | System administration commands | mount, iptables, useradd |
Why sections matter#
Consider crontab:
man crontab # Section 1 — the crontab command (how to edit your crontab)
man 5 crontab # Section 5 — the crontab file format (syntax of the schedule)Or passwd:
man passwd # Section 1 — the passwd command (changing passwords)
man 5 passwd # Section 5 — the /etc/passwd file format (fields and structure)Or printf:
man printf # Section 1 — the shell printf command
man 3 printf # Section 3 — the C library printf() functionIf you open a man page and it’s not what you expected, you’re probably looking at the wrong section.
Specifying a section#
man 2 open # The open() system call
man 3 sleep # The C sleep() function (not the shell command)
man 5 fstab # The fstab file format
man 8 mount # The mount command (system administration)Listing all available sections for a name#
man -f crontab
# crontab (1) - maintain crontab files for individual users
# crontab (5) - tables for driving cron
# Equivalent command:
whatis crontabStructure of a Man Page#
Most man pages follow a standard layout:
| Section | Contents |
|---|---|
| NAME | Command name and one-line description |
| SYNOPSIS | Usage syntax — how to invoke it |
| DESCRIPTION | Detailed explanation of what it does |
| OPTIONS | List of flags and arguments |
| EXAMPLES | Usage examples (not all pages have this) |
| FILES | Related files (config files, log locations) |
| EXIT STATUS | What return codes mean |
| SEE ALSO | Related man pages |
| BUGS | Known issues |
| AUTHOR | Who wrote it |
Not every man page has every section, but NAME, SYNOPSIS, DESCRIPTION, and OPTIONS are almost always present.
Reading the SYNOPSIS#
The SYNOPSIS tells you how to invoke a command. It uses formatting conventions to show what’s required, what’s optional, and what can be repeated:
ls [OPTION]... [FILE]...| Format | Meaning |
|---|---|
UPPERCASE | A placeholder — substitute your own value |
[brackets] | Optional |
... | Can be repeated |
| `a | b` |
bold or literal | Type exactly as shown |
So ls [OPTION]... [FILE]... means:
ls— the command itself (required)[OPTION]...— zero or more options (all optional)[FILE]...— zero or more filenames (optional; defaults to current directory)
A more complex example:
cp [OPTION]... SOURCE... DEST
cp [OPTION]... -t DIRECTORY SOURCE...This shows cp has two forms. In the first, you provide one or more source files and a destination. In the second, you use -t to specify the target directory first.
Finding Man Pages#
apropos — Search by keyword#
When you don’t know the command name, search the man page descriptions:
apropos partition
# cfdisk (8) - display or manipulate a disk partition table
# fdisk (8) - manipulate disk partition table
# parted (8) - a partition manipulation program
# sfdisk (8) - display or manipulate a disk partition table
apropos "copy file"
# cp (1) - copy files and directories
# install (1) - copy files and set attributesapropos searches the NAME section of all man pages. It’s equivalent to man -k:
man -k networkwhatis — One-line description#
whatis grep
# grep (1) - print lines that match patterns
whatis mount
# mount (2) - mount filesystem
# mount (8) - mount a filesystemUpdating the man page database#
apropos and whatis rely on a database. If they return nothing, update it:
sudo mandbPractical Examples#
Find all man page sections for a command#
man -f open
# open (1) - start a file in its preferred application
# open (2) - open and possibly create a file
# Then read the one you need
man 2 openSearch for all pages about “firewall”#
apropos firewall
# firewalld (1) - Dynamic Firewall Manager
# iptables (8) - administration tool for IPv4 packet filtering
# nft (8) - nftables command line toolRead just a specific section of a man page#
Use the search feature. Open the man page and jump directly to EXAMPLES:
man rsync
# Then type:
/^EXAMPLESThe ^ anchors to the start of a line, so this finds the EXAMPLES heading.
View a man page for a config file#
man 5 sshd_config # SSH server configuration options
man 5 resolv.conf # DNS resolver configuration
man 5 fstab # Filesystem mount table format
man 5 sudoers # sudo configuration fileThis is one of the most underused features. When you need to edit a config file and aren’t sure of the syntax, the section 5 man page has the authoritative reference.
man vs --help vs info#
You’ll encounter three documentation systems:
| Method | When to use |
|---|---|
man command | Full documentation — options, examples, related files |
command --help | Quick summary of flags — enough when you just need a reminder |
info command | Extended documentation (GNU tools) — more verbose, hyperlinked |
In practice, man is what you’ll use 90% of the time. --help is useful for a quick flag check without opening the pager. info has more detail for some GNU tools (like tar, coreutils) but most people never need it.
# Quick flag reminder
tar --help | grep "exclude"
# Full explanation with context
man tarControlling How Man Pages Display#
Open in a specific pager#
# Use less (default)
man ls
# Pipe to grep for quick searches
man ls | grep -A2 "\-t,"Export a man page to plain text#
man ls | col -bx > ls-manual.txtView a man page from a specific path#
man ./my-custom-tool.1Section 2 and 3: For Developers#
If you write C programs or want to understand how Linux works at a lower level, sections 2 and 3 are essential:
man 2 fork # How processes are created
man 2 execve # How programs are launched
man 2 open # How files are opened at the kernel level
man 2 socket # How network sockets are created
man 3 malloc # Memory allocation
man 3 strcmp # String comparison
man 3 getenv # Reading environment variablesThese pages document the interface between your programs and the Linux kernel (section 2) or the C standard library (section 3). Even if you don’t write C, reading these helps you understand what’s happening beneath the shell commands you run daily.
Best Practices#
- Start with
man commandbefore searching the web — it’s faster, works offline, and is always accurate for your installed version - Use
man 5 filenamewhen editing config files — the syntax reference is right there - Use
apropos keywordwhen you know what you want to do but not which command does it - Check SEE ALSO at the bottom of man pages — it links to related tools and pages you might need
- Use
man -f commandto discover if a command exists in multiple sections - Search within man pages with
/pattern— don’t read top to bottom when you need one specific flag - Read the SYNOPSIS carefully — it tells you the exact invocation syntax without guessing
- Run
sudo mandbifaproposreturns empty results — the database may need refreshing


