How to use man command in Linux?

man is the system’s manual pager. The man command in Linux is an interface to the on-line reference manuals. It is best place to understand any command in Linux. So, lets see how to use man command in Linux?

Syntax

$man <argument>

Example

$man ls

will display the manual page for ls command

Description

A manual page has 9 sections. Each section contains pages of different types of arguments like command, system calls, library functions etc. The table below shows the section number along with the type of pages they contain.

SectionContent Type
1Shell Commands e.g., cat, ls, pwd, passwd. ($man cat)
2System calls e.g., fork, read, write. ($man 2 fork)
3Library functions e.g, printf, scanf. ($man $printf)
4Special files found in /dev e.g., random, tty ($man 4 random)
5File formats e.g., /etc/passwd ($man 5 passwd)
6Games e.g., intro ($man 6 intro)
7Miscelleneous e.g., groff ($man 7 groff)
8System Admin commands e.g., mkfs, mcs $man 8 mkfs)
9kernel Routines

You might notice that passwd is used in example for section 1 and section 5. passwd is a command which is used to set or change user password. For this the manual page is in section 1 so we write

$man 1 passwd

or simple

$man passwd

But there is a /etc/passwd file which contains the details about all the users in the system. To manual page for this passwd file is in section 5, so we write

$man 5 passwd

Navigating a man Page in Linux

The following keys can be used to navigate through a man page

KeyUse
SpacebarScroll down one page
PageDownScroll down one page
PageUpScroll up one page
DownArrowScroll down one line
UpArrowScroll up one line
dScroll down one-half page
uScroll up one-half page
/stringSearch forward for string in page
nRepeat previous search forward in man page
NRepeat previous search backward in man page
gGo to start of manual page
GGo to end of manual page
qExit man page

Relevant Commands

pwd
ls
umask
useradd

Leave a Reply

Your email address will not be published. Required fields are marked *