Often, a man page is referenced via suffixing it with the section enclosed in parentheses, e.g.:
read(2)
This style has two main advantages:
- it is immediately clear that you reference a man page - i.e. you can write somthingsomething like 'cf. read(3)' instead of 'cf. the section 3 man page of read'
- if multiple sectionsections contain man pages with the same name, specifying the section is more precise
Man pages are organized in sections, e.g. sectionSection 1 includes all user command man pages, sectionSection 2 all man pages for the system calls, sectionSection 3 is for library functions etc.
On the command line, if you don't explicitly specify the section you get the first matching man page, in the default section traversal order, e.g.:
$ man read
displays BASH_BUILTINS(1)
on Fedora. Where
$ man 2 read
displays the man page for the read()
system call.
Note that the positional specification of the section is not portable - e.g. on Solaris you would specify it like this:
$ man -s 2 read
Usually, man man
also lists some of the available sections. But not necessarily all. For listing all available sections one may list the subdirectories of all directories listed in the default man path or the environment variable $MANPATH
. For example on a Fedora 23 system with some development packages installsinstalled /usr/share/man
has following subdirectories:
cs es id man0p man2 man3x man5x man7x man9x pt_BR sk zh_CN
da fr it man1 man2x man4 man6 man8 mann pt_PT sv zh_TW
de hr ja man1p man3 man4x man6x man8x pl ro tr
en hu ko man1x man3p man5 man7 man9 pt ru zh
The directories with the man
prefix represent each section - while the other ones contain translated sections. Thus, to get a list of non-empty sections one could issue a command like this:
$ find /usr/share/man -type f | sed 's@^.*/man\(..*\)/.*$@\1@' \
| sort -u | column
0p 1p 3 4 6 8
1 2 3p 5 7
(the sections ending with p
are PosixPOSIX man pages)
To view a man page in another language (if available) one can set a language related environment variable, e.g.:
$ LC_MESSAGES=de_DE man read
Also, each section should have an introduction man page named intro
, e.g. viewable via:
$ man 2 intro