Using the man command

Man (short for manual) pages are the most used source of Linux documentation for various programs, utilities, system calls, library files, configuration files, and kernels that exist within the system. The whole man documentation is organized in nine sections, where each section caters for a particular type of documentation. By default, if there are multiple sections for one command, it displays the documentation from the first section it encounters. The syntax for man command usage is as follows:

$ man <topic name>

Upon execution of the preceding command, the specified topic's contents will be displayed on one screen at a time. Use the arrow keys for scrolling line by line, or press the Space bar for the next screen. By default, man pages are opened in the less viewer.

The following table lists the man page navigation command keys and their description:

Key

Description

Space bar/Page Down

Scroll down one screen

Page Up

Scroll up one screen

Down arrow ()

Scroll down a single line

Up arrow ()

Scroll up a single line

/string

Search forward (down) for the given string in the man page

?string

Search backward (up) for the given string in the man page

n

Repeat the previous search forward in the man page

N

Repeat the previous search backward in the man page

q

Exit the man and return to the prompt

g/Home

Go to the start of the man page

G/End

Go to the end of the man page

 

Some useful options that are used with the man command include the following:

  • $ man -f <topic name>: Gives a brief description of that topic (the equivalent of the whatis command). See the following screenshot for usage:

  • $ man -k <topic name>: Lists all the matching pages that discuss a specified topic in their man pages (the equivalent of apropos). See the following screenshot for usage:

  • $ man -a <topic name>: Displays, in sequence, all the man pages with the given topic name from all sections. For example, man -a passwd will list all the man pages containing passwd in any section.
  • $ man <section number> <topic name>: Forces the man command to display topic documentation from a given section. Otherwise, by default, it displays the most popular section when used without a section number, as shown in the following command:
$ man passwd

Output on execution of the preceding command is shown in the following screenshot:

The man command with a specified section lists the documentation from that particular section as shown in following command:

$ man 5 passwd

Output on execution of the preceding command is shown in the following screenshot:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.70.157