It's the "section" of the man
-page - that number in parenthesis following the name, for example ls(1)
.
You could think of the man-pages as a set of actual manuals, divided into several volumes. For example, the 1st "volume" is section 1 which contains ordinary user commands - like ls(1), bash(1) and man(1). Section 8 contains commands for the system administrator - like commands for shutting down the system and install packages. (often commands that can't be used by non-root users.) Section 5 contains file-formats - like how /etc/passwd and /etc/sudo should be formatted. Section 3 contains library-functions for various languages (mostly for C) - like the C-function printf().
Note that some "commands" - like cd
and fg
- are really so-called built-ins in the shell, and don't have their own man-page. Instead they're documented in the man-pages for the particular shell - eg. in the man-page of bash(1). Shells may also provide alternatives to some commands as built-ins, and will usually use these instead of the external command. One example is how bash(1) got a built-in version of kill(1).
From the man-page of man-pages(7):
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g.
man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
Sometimes letters or words are added to the number to denote the man-page belongs to a sub-system or package, for example, "x" for X GUI commands like startx(1x), or "tcl" for commands and functions belonging to the Tcl-language. Or even that they're "optional"/"additional" or "alternative" commands - for example, if you got two versions of tar
, one from GNU and one from BSD.
To get a specific section, you can add the section-number to your man-command:
man passwd
returns the passwd-command from section 1 (because section 1 is searched first, and the search then stops)
man 1 passwd
returns the same (but now because we specified section 1)
man 5 passwd
returns the file-format of /etc/passwd from section 5 (because we specified section 5 instead of 1)
To differentiate the two, you would refer to them as passwd(1) and passwd(5) (eg. if you wrote a textbook - or a man-page).
So the search-order makes sense - commands are more often sought than file-formats, not to mention programming libraries and system-calls.
Finally, you should note that different Unix-systems may use slightly different sectioning, for example, I've seen section 7 used for word-processing commands, and section 9 used for games, and I've seen section 9 used as a catch-all for various man-pages not fitting elsewhere.
export MANSECT=0p:1:2:3:3p:4:5:6:7:8:9:l:s:n
– meuh Nov 20 '18 at 12:30