my question describes it all actually. I wanted to know what is the difference between man
and man 3
command to get the manual pages for unix commands?

- 50,943
- 13
- 104
- 142

- 11,962
- 23
- 81
- 107
-
1Section 3 contains library functions. – devnull Mar 07 '14 at 17:25
-
1You might want to see `man man`. – devnull Mar 07 '14 at 17:26
3 Answers
UNIX command man pages are grouped in sections. See the section descriptions here.
General command line commands are in section 1. When you type man command
, then man
will give you the man page for command
in the first section it finds it.
However, some commands may exist in more than one section. So if you have a shell command read
and you type man read
, you'll get the section 1 definition. But if you want the library call read
, you would enter man 3 read
which would tell man
to go right to section 3 specifically.

- 56,987
- 9
- 69
- 103
You can have identically named man pages in different sections. For example,
man 1 printf
will give you the manual for the printf
command, while
man 3 printf
will give you the manual for the C library routine printf
. If you don't specify a section number, you'll get the command from the first section that contains a match.

- 497,756
- 71
- 530
- 681
If you provide a number to man
, you are telling it to look in exactly one section of the manual for the command in question. (Practically speaking this means looking in a specific directory of man
files.) As it says in the man
man page
:
A section, if provided, will direct man to look only in that section of the manual.
The default action is to search in all of the available sections, following a pre-defined
order and to show only the first page found, even if page exists in several sections.
Section 3, in Linux, is typically reserved for functions within libraries, such as C/C++ libraries that happen to have man
pages.

- 5,456
- 3
- 37
- 49