PROGNAME(x) references in manpages -- What does the digit in ()s mean? [duplicate]
If you run man man
you will see the following information in the man page:
1 Executable programs or shell commands2 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/passwd6 Games7 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]
Some names are associated with multiple entries, eg on my system 'sleep' has an entry in section 1 and an entry in section 3. You can specify the one you want with e.g.
man 3 sleep
Sometimes I just guess with
man -a sleep
which displays each entry associated with sleep in turn. I just go through them until I find the one I want. You can also try
man -k sleep
to get a slightly bigger listing of pages involving the term 'sleep'
The number indicates which section the manpage is in. For your examples:
grep(3)
To get the documentation, type
man 3 grep
More commonly, if there is no grep(2)
or grep(1)
, you can get away with
man grep
However, I should note that grep
is in section 1. Section 3 is generally reserved for C functions. An example is getopt
: getopt(1)
refers to the command-line utility getopt
, but getopt(3)
refers to the C function getopt
. Likewise, read(1)
is a program that reads from standard input, but read(2)
is a POSIX system call for use in programs - it is one of the lowest-level forms of input you can get on most Linux (and other Unix) systems.