OSETC TECH

Linux Man Command

Linux command man  is one of the most useful command when you worked on Linux system. everybody know that man command can help you to print the help information of  linux command.  you maybe just know its simple usage. there are other usages of man command that you also should know.  this post will show you how to deep understand linux man command.

Man command use to format and display the on-line manual pages,  these manual information wrote by each command’s develper. and the manual include about 8 sections as below:

man1: User programs

Manual pages that describe publicly accessible commands are contained

in this chapter. Most program documentation that a user will need to

use is located here.

man2: System calls

This section describes all of the system calls (requests for the kernel

to perform operations).

man3: Library functions and subroutines

Section 3 describes program library routines that are not direct calls

to kernel services. This and chapter 2 are only really of interest to

programmers.

man4: Special files

Section 4 describes the special files, related driver functions, and

networking support available in the system. Typically, this includes

the device files found in /dev and the kernel interface to networking

protocol support.

man5: File formats

The formats for many data files are documented in the section 5. This

includes various include files, program output files, and system files.

man6: Games

This chapter documents games, demos, and generally trivial programs.

Different people have various notions about how essential this is.

man7: Miscellaneous Manual pages that are difficult to classify are

designated as being section 7. The troff and other text processing

macro packages are found here.

man8: System administration Programs used by system administrators

for system operation and maintenance are documented here. Some of

these programs are also occasionally useful for normal users.

When we view the manual guide of one command using “man” command,  it mainly shown up the first (man 1)and the fifth (man 5) section part.

 For example, “man ls” command same as “man 1 ls”, it will show “ls” command ‘s  man 1 section information. you also can see the “LS(1)” string from manual page, the “1” indicated that “man ls” command will call “man 1 ls”.

All manual page are stored under “/usr/share/man” directory:

[root@osetc~]# ls -l /usr/share/man

total 352

drwxr-xr-x. 5 root root   4096 Dec 17  2012 bg

drwxr-xr-x. 5 root root   4096 Apr  3  2012 cs

drwxr-xr-x. 5 root root   4096 Dec 17  2012 da

drwxr-xr-x. 5 root root   4096 Apr  3  2012 de

drwxr-xr-x. 5 root root   4096 Dec 17  2012 el

drwxr-xr-x. 5 root root   4096 Dec 17  2012 en

drwxr-xr-x. 5 root root   4096 Dec 17  2012 es

drwxr-xr-x. 5 root root   4096 Dec 17  2012 fi

drwxr-xr-x. 6 root root   4096 Apr  3  2012 fr

drwxr-xr-x. 5 root root   4096 Dec 17  2012 hr

drwxr-xr-x. 4 root root   4096 Dec 17  2012 hu

drwxr-xr-x. 3 root root   4096 Dec 17  2012 id

drwxr-xr-x. 6 root root   4096 Apr  3  2012 it

drwxr-xr-x. 5 root root   4096 Apr  3  2012 ja

drwxr-xr-x. 5 root root   4096 Dec 17  2012 ko

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man0p

drwxr-xr-x. 2 root root  36864 May 12  2014 man1

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man1p

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man1x

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man2

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man2x

drwxr-xr-x. 2 root root 110592 Apr 22  2014 man3

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man3p

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man3x

drwxr-xr-x. 2 root root   4096 Dec 17  2012 man4

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man4x

drwxr-xr-x. 2 root root   4096 Apr 22  2014 man5

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man5x

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man6

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man6x

drwxr-xr-x. 2 root root   4096 Apr 22  2014 man7

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man7x

drwxr-xr-x. 2 root root  20480 May 12  2014 man8

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man8x

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man9

drwxr-xr-x. 2 root root   4096 Sep 23  2011 man9x

drwxr-xr-x. 2 root root   4096 Sep 23  2011 mann

drwxr-xr-x. 5 root root   4096 Dec 17  2012 nl

drwxr-xr-x. 5 root root   4096 Apr  3  2012 pl

drwxr-xr-x. 5 root root   4096 Dec 17  2012 pt

drwxr-xr-x. 5 root root   4096 Dec 17  2012 pt_BR

drwxr-xr-x. 5 root root   4096 Dec 17  2012 ro

drwxr-xr-x. 6 root root   4096 Dec 17  2012 ru

drwxr-xr-x. 3 root root   4096 Dec 17  2012 sk

drwxr-xr-x. 5 root root   4096 Dec 17  2012 sl

drwxr-xr-x. 6 root root   4096 Dec 17  2012 sv

drwxr-xr-x. 5 root root   4096 Dec 17  2012 tr

drwxr-xr-x. 4 root root   4096 Dec 17  2012 zh_CN

drwxr-xr-x. 4 root root   4096 Dec 17  2012 zh_TW

If you want to check which man section include for linux command,  use “man” command with “-f” option, type:

[root@osetc man5]# man -f init

init                 (5)  - Upstart init daemon job configuration

init                 (8)  - Upstart process management daemon

Display all the manual pages that match command name, using “man -a” command, type:

[root@osetc man5]# man -a init

By default, man will exit after displaying the first manual page it find. Using the option “-a” forces man to display all the manual pages that match name, not just the first.