Reputation: 16509
For example: man(1)
, find(3)
, updatedb(2)
?
What do the numbers in parentheses (Brit. "brackets") mean?
Upvotes: 676
Views: 62208
Reputation: 53115
As @Ian G says, they are the man page sections. Let's take this further though and learn how to see what the sections are, how to search within all man pages, and how to search within a specific man page section.
man man-pages
for the list of sectionsLearned from @shea's comment here.
From man man-pages
:
Sections of the manual pages
The manual Sections are traditionally defined as follows:
1 User commands (Programs)
Commands that can be executed by the user from within a shell.
2 System calls
Functions which wrap operations performed by the kernel.
3 Library calls
All library functions excluding the system call wrappers (Most
of the libc functions).
4 Special files (devices)
Files found in /dev which allow to access to devices through the
kernel.
5 File formats and configuration files
Describes various human-readable file formats and configuration
files.
6 Games
Games and funny little programs available on the system.
7 Overview, conventions, and miscellaneous
Overviews or descriptions of various topics, conventions and
protocols, character set standards, the standard filesystem lay‐
out, and miscellaneous other things.
8 System management commands
Commands like mount(8), many of which only root can execute.
To search the man pages, use the apropos
command. See man apropos
and apropos -h
. "apropos" comes from the French phrase "à propos", which means "about", or "concerning", or, translated literally: "to [what] purpose".
So, to search for the word "network" throughout all of the manual page sections, including their page names and descriptions, type in apropos network
.
To search for multiple words, separate them with a space. Ex: apropos file system
.
To search for the exact phrase "file system", put it in quotes. Ex: apropos "file system"
.
Snippet of a search and its output, showing the man page commands and sections where this phrase is found:
$ apropos "file system"
blkcat (1) - Display the contents of file system data unit in a disk image.
blkls (1) - List or output file system data units.
blkstat (1) - Display details of a file system data unit (i.e. block or sector)
chattr (1) - change file attributes on a Linux file system
cifs.idmap (8) - Userspace helper for mapping ids for Common Internet File System (CIFS)
cifs.upcall (8) - Userspace upcall helper for Common Internet File System (CIFS)
man
command with man man
, and it shows the full list of 9 sectionsDESCRIPTION
man is the system's manual pager. Each page argument given
to man is normally the name of a program, utility or func‐
tion. The manual page associated with each of these argu‐
ments is then found and displayed. 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 sec‐
tions following a pre-defined order ("1 n l 8 3 2 3posix 3pm
3perl 5 4 9 6 7" by default, unless overridden by the SEC‐
TION directive in /etc/manpath.config), and to show only the
first page found, even if page exists in several sections.
The table below shows the section numbers of the manual fol‐
lowed by the types of pages they contain.
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 conven‐
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
A manual page consists of several sections.
man <section_num> <cmd>
Let's imagine you are Googling around for Linux commands. You find the OPEN(2)
pg online: open(2) — Linux manual page.
To see this in the man pages on your pc, simply type in man 2 open
.
For FOPEN(3)
use man 3 fopen
, etc.
man <section_num> intro
To read the intro pages to a section, type in man <section_num> intro
, such as man 1 intro
, man 2 intro
, man 7 intro
, etc.
To view all man page intros in succession, one-after-the-other, do man -a intro
. The intro page for Section 1 will open. Press q to quit, then press Enter to view the intro for Section 8. Press q to quit, then press Enter to view the intro for Section 3. Continue this process until done. Each time after hitting q, it'll take you back to the main terminal screen but you'll still be in an interactive prompt, and you'll see this line:
--Man-- next: intro(8) [ view (return) | skip (Ctrl-D) | quit (Ctrl-C) ]
Note that the Section order that man -a intro
will take you through is:
This search order is intentional, as the man man
page explains:
The default action is to search in all of the available sections follow‐
ing a pre-defined order ("1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7" by default, unless overrid‐
den by the SECTION directive in /etc/manpath.config)
Why did they choose this order? I don't know (please answer in the comments if you know), but just realize this order is correct and intentional.
Upvotes: 40
Reputation: 10939
It's the section that the man page for the command is assigned to.
These are split as
Original descriptions of each section can be seen in the Unix Programmer's Manual (page ii).
In order to access a man page given as "foo(5)", run:
man 5 foo
Upvotes: 640
Reputation: 137
Wikipedia details about Manual Sections:
Upvotes: 4
Reputation: 1360
The reason why the section numbers are significant is that many years ago when disk space was more of an issue than it is now the sections could be installed individually.
Many systems only had 1 and 8 installed for instance. These days people tend to look the commands up on google instead.
Upvotes: 68
Reputation: 1302
Note also that on other unixes, the method of specifying the section differs. On solaris, for example, it is:
man -s 1 man
Upvotes: 11
Reputation: 48121
It indicates the section of the man pages the command is found in. The -s switch on the man command can be used to limit a search to certain sections.
When you view a man page, the top left gives the name of the section, e.g.:
User Commands printf(1)
Standard C Library Functions printf(3C)
So if you are trying to look up C functions and don't want to accidentally see a page for a user command that shares the same name, you would do 'man -s 3C ...'
Upvotes: 10
Reputation: 340446
The section the command is documented in the manual. The list of sections is documented on man's manual. For example:
man 1 man
man 3 find
This is useful for when similar or exactly equal commands exist on different sections
Upvotes: 99