Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PROGNAME(x) references in manpages -- What does the digit in ()s mean? [duplicate]

Tags:

unix

manpage

Possible Duplicate:
Why do programs in Unix-like environments have numbers after their name?

I have seen several programs, such as GREP(3) and PING(8), listed in manpages. What is the significance of the digit in ()s?

like image 509
Billy ONeal Avatar asked May 20 '09 03:05

Billy ONeal


3 Answers

If you run man man you will see the following information in the man page:

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]

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'

like image 74
leif Avatar answered Oct 26 '22 13:10

leif


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.

like image 24
Chris Lutz Avatar answered Oct 26 '22 11:10

Chris Lutz


It's to tell you what man page section help is in... 8 is typically the location of Administrative related utilities (/sbin, /usr/sbin, etc.)

So help for GREP(3) is in man page section 3, and you could type man 3 grep to get the help for grep(3) directly.

like image 1
John Weldon Avatar answered Oct 26 '22 12:10

John Weldon