Linux / UNIX: Getting help with man pages and how to use them

Posted on in Categories , , , , , , , , , , , last updated May 9, 2017

I have CentOS 5/6/7 server located in a remote data center. How do I get more help about command and its syntax on Linux or Unix-like system from a shell prompt?

Linux and UNIX-like system comes with man (manual) pages. The man command is used to format and display the man pages. This tutorial shows you how to use man command in Linux and Unix-like system. The man command displays pages from reference manual. You can learn about command and it syntax. Each man page has following information:

  • Command name along with a short description
  • A SYNOPSIS of command usages
  • A Description
  • A listing of all its options (switches)
  • A list of config files or associated files
The man Command
The man Command

man page sections

Each man page comes in sections. The table below shows the section numbers of the manual followed by the types of pages they contain:

  • Section # 1 : User command (executable programs or shell commands)
  • Section # 2 : System calls (functions provided by the kernel)
  • Section # 3 : Library calls (functions within program libraries)
  • Section # 4 : Special files (usually found in /dev)
  • Section # 5 : File formats and conventions eg /etc/passwd
  • Section # 6 : Games
  • Section # 7 : Miscellaneous (including macro packages and conventions),
  • Section # 8 : System administration commands (usually only for root)
  • Section # 9 : Kernel routines [Non standard]

So you see commands or files are referred by a name followed by manual section number in parentheses. For example, useradd(8) refers to the user add command from sys admin section # 8.

man command examples

Just use man command as follows:
man {command-name}
man {section} {command-name}

For example, display clear command man page, enter:
$ man clear
To display passwd file format man page (from section # 5):
$ man 5 passwd
To display more information about passwd command itself (from section # 1):
$ man 1 passwd

Search man page referenced by printf

To lookup the manual pages referenced by smail and print out the short descriptions of any found. For example:
$ man -f printf
Sample outputs:

printf (1)           - format and print data
printf (3)           - formatted output conversion

This command is equivalent to whatis printf:
$ whatis -r printf

Search man page by keywords

Search the short descriptions and manual page names for the keyword printf as regular expression. Print out any matches.
$ man -k passwd
$ man -k printf

This command is equivalent to apropos printf:
$ apropos printf
$ apropos passwd

How do I save man pages to a text file?

The syntax is:
$ man ls | col -b > ls.txt
$ less less.txt
$ vi less.txt

Display all matching man pages

You can display, in succession, all of the available passwd manual pages contained within the manual. It is possible to quit between successive displays or skip any of them.
$ man -a passwd
To view next man page just hit [Enter] key, to skip press [CTRL+D] and to quit type [Ctrl+C].

info documentation

You can read documentation in Info format. This is another system that organizes its information into sections. info, a command used to view such documentation produced by Texinfo, a computer program documentation system developed for and by the GNU Project.

info syntax

info {command-name}
For example display ls command info page:
$ info ls
In some cases, info command can offer more detailed help as compare to man page. For example try following two commands:
$ man date
$ info date

Info page navigation commands

  • q – Quit info page
  • n – Goto next section
  • p – Goto previous section
  • u – Goto one level up

You can start at buffers node within emacs manual
$ info emacs buffers


You may also find /usr/share/doc a good place for more documentation. Both Gnome and KDE provides graphical help system under help menu. You can get help by pressing F1 key:
$ cd /usr/share/doc/
$ ls -l
$ ls -l | more
$ cd bash
$ ls -l

Sample outputs:

total 684
-rw-r--r--    1 root     root        315176 Jan 24 10:09 CHANGES
-rw-r--r--    1 root     root         19000 Jan 24 10:09 COMPAT
-rw-r--r--    1 root     root         99588 Jan 24 10:09 FAQ
-rw-r--r--    1 root     root          7072 Jan 24 10:09 INTRO
-rw-r--r--    1 root     root         77335 Jan 24 10:09 NEWS
-rw-r--r--    1 root     root          9279 Jan 24 10:09 POSIX
-rw-r--r--    1 root     root          1705 Jan 24 10:09 RBASH
-rw-r--r--    1 root     root          3839 Jan 24 10:09 README
-rw-r--r--    1 root     root        329685 Jan 24 10:09 bash.html
-rw-r--r--    1 root     root        842052 Jan 24 10:09 bashref.html

Use the more command to view docs:
$ more FAQ
$ grep word FAQ
$ vi FAQ

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

3 comment

  1. Here are some more hints:

    * in addition to man pages, there are also the info pages. Info pages dig deeper into the heart of the matter then man pages.

    * When using KDE, you can view the man pages in Konqueror by going to Start->Run and typing in the box: #dir
    (for dir man page)
    or: ##dir
    (for dir info page)

Comments are closed.