man – display manual pages

man command
man command

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

SectionContents
1User commands
2System calls
3Library functions
4Special files (/dev)
5File formats
6Games
7Miscellaneous
8System 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
KeyAction
SpaceNext page
bPrevious page
/patternSearch
nNext match
qQuit

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

OptionDescription
-kSearch by keyword (same as apropos)
-fShow description (same as whatis)
-aShow all matching pages
-wShow 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