man shows the manual page for a command, configuration file or programming function. Manual pages are installed with the software, so they describe the version on your machine and work offline.
Opening a page
$ man lsThe page usually opens in less. Press Space to move down, /word to search, n for the next match and q to quit.
The layout of a page
Common headings are:
- NAME: the command and a one line summary.
- SYNOPSIS: how to type it.
- DESCRIPTION: what it does, often with the options.
- EXAMPLES and SEE ALSO: present on many pages, not all.
In the SYNOPSIS, square brackets mark optional parts and ... means repeatable.
Sections
The manual is divided into numbered sections. The most useful are:
- 1: user commands
- 5: file formats and configuration files
- 8: system administration commands
The same name can exist in more than one. passwd is both a command and a file:
$ man passwd
$ man 5 passwdThe first normally shows the command, and the second shows the format of /etc/passwd. A reference such as crontab(5) means the crontab page in section 5.
Searching by keyword
If you do not know the command name, search the page summaries:
$ man -k "list directory"
dir (1) - list directory contents
ls (1) - list directory contents
vdir (1) - list directory contentsResults depend on which packages are installed. man -k does the same job as apropos. If it finds nothing on a new system, the page index may need building with sudo mandb on many Linux distributions.
When there is no page
$ man cd
No manual entry for cdShell built-ins are often documented through help cd or in man bash instead, though some distributions provide their own pages for them. Minimal installs and containers may remove manual pages altogether to save space.
Try it
- Open
man lsand search forsort. - Compare
man passwdwithman 5 passwd. - Run
man -k directory. - Read
man manto learn about the other sections.
Check your understanding
man
All 5 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.