man
100%

Command Line · Lesson 16

man

Learn how to open, navigate, search, and select sections of installed manual pages.

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.

Which command opens the installed manual page for ls?

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 /pattern and press Enter to search forward.
  • Press n to repeat the search in the same direction.
  • Press N to repeat it in the opposite direction.
  • Press q to 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.

With a man page open in less, what starts a forward search for --recursive?

With a man page open in the usual pager, which key returns to the shell?

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.

Which command opens the section 5 page that documents the passwd file format?

When a Page Is Missing

Not every command name has a separately installed manual page. If man reports that no entry exists:

  • Run type NAME to see how Bash resolves the name.
  • Use help NAME when it is a Bash builtin.
  • Try NAME --help when an external program supports that convention.
  • Check whether your distribution offers a separate documentation package.

type cd reports that cd is a Bash builtin, and no separate man page is available. Which command should you try next?

Lesson complete

You finished man

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.

Keep your learning progress

Create a free account to save this lesson and continue learning on any device.

Create a free account
Next Lesson
Back to Command Line