Command Line · Lesson 16 of 19
man
0 / 5 checkpoints answered
Many Linux commands, interfaces, configuration files, and administrative tools have installed reference documentation called manual pages, or man pages. The man command finds and displays those pages.
Opening a Manual Page
Pass a topic name to man. For example, open the page for ls with:
$ man ls
Manual pages commonly include a synopsis, description, options, related files, and cross-references, although the exact sections vary.
CheckWhich command opens the installed manual page for ls?
press 1/2/3 to answer · → next lesson
Navigating and Searching a Page
On many systems, man displays pages through a pager such as less. While a page is open, you can scroll with arrow or page keys and use these controls:
Inside a man page:
- Type
/patternand press Enter to search forward. - Press
nto repeat the search in the same direction. - Press
Nto repeat it in the opposite direction. - Press
qto quit.
The pager can differ by system or environment, so its exact keys are not guaranteed everywhere. The controls above apply to the common less setup.
CheckWith a man page open in less, what starts a forward search for --recursive?
press 1/2/3 to answer · → next lesson
CheckWith a man page open in the usual pager, which key returns to the shell?
press 1/2/3 to answer · → next lesson
Selecting a Manual Section
The manual is organized into numbered sections. Common sections include:
1: User commands.2: System calls.3: Library functions.5: File formats.8: System administration commands.
The same topic can appear in more than one section. Put the section before the topic to select one explicitly:
$ man 5 passwd
$ man 1 passwd
The first command opens the passwd file-format page from section 5. The second opens the user command page from section 1. References such as passwd(5) use the same topic(section) notation.
CheckWhich command opens the section 5 page that documents the passwd file format?
press 1/2/3 to answer · → next lesson
When a Page Is Missing
Not every command name has a separately installed manual page. If man reports that no entry exists:
- Run
type NAMEto see how Bash resolves the name. - Use
help NAMEwhen it is a Bash builtin. - Try
NAME --helpwhen an external program supports that convention. - Check whether your distribution offers a separate documentation package.
Checktype cd reports that cd is a Bash builtin, and no separate man page is available. Which command should you try next?
press 1/2/3 to answer · → next lesson
Summary
You can now locate and navigate installed manual documentation.
- Open a page by topic name.
- Search and move through a page in the usual pager.
- Quit the pager and return to the shell.
- Select a numbered manual section.
- Choose another help source when a page is unavailable.
Lesson complete
You finished man. Nice work — keep the momentum going.