Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top