man displays manual pages for commands, functions, and system files. It’s the primary documentation system on Unix.
Synopsis
man [SECTION] NAME
man -k KEYWORD
Manual Sections
| Section | Contents |
|---|
| 1 | User commands |
| 2 | System calls |
| 3 | Library functions |
| 4 | Special files (/dev) |
| 5 | File formats |
| 6 | Games |
| 7 | Miscellaneous |
| 8 | System admin commands |
Examples
View command manual
$ man ls
$ man grep
$ man ssh
Specify section
$ man 5 passwd # File format, not command
$ man 3 printf # C library function
$ man 2 open # System call
Search for keyword
$ man -k copy
cp (1) - copy files and directories
dd (1) - convert and copy a file
scp (1) - secure copy
$ man -k "disk usage"
df (1) - report file system disk space usage
du (1) - estimate file space usage
One-line description
$ whatis ls
ls (1) - list directory contents
$ whatis -s 5 passwd
passwd (5) - the password file
Navigation (same as less)
| Key | Action |
|---|
Space | Next page |
b | Previous page |
/pattern | Search |
n | Next match |
q | Quit |
Manual Page Sections
Most man pages include:
- NAME — Command name and brief description
- SYNOPSIS — Usage syntax
- DESCRIPTION — Detailed explanation
- OPTIONS — Available flags
- EXAMPLES — Usage examples
- SEE ALSO — Related commands
- AUTHOR — Who wrote it
- BUGS — Known issues
Common Options
| Option | Description |
|---|
-k | Search by keyword (same as apropos) |
-f | Show description (same as whatis) |
-a | Show all matching pages |
-w | Show location of man page |
Tips
- Search first:
man -k keyword when you don’t know the command - Check sections: Some names exist in multiple sections (passwd, printf)
- Online fallback:
curl cheat.sh/command for quick examples - Set PAGER:
export MANPAGER='less -R' for colors - Export to text:
man ls | col -b > ls.txt
Alternatives
# Brief help
$ ls --help
# Info pages (more detailed, different format)
$ info coreutils
# tldr pages (simplified examples)
$ tldr tar
# cheat.sh (online)
$ curl cheat.sh/tar
See Also
- info — GNU info documentation
- apropos — Search man pages by keyword
- whatis — One-line manual descriptions
Tutorials