1

What's the significance of the number, like the 2 in STAT(2), seen in man pages?

For example, man 2 stat yields a man page with STAT(2) at the top and a description that begins, The stat() function..., while man stat yields a man page with STAT(1) at the top and a description that begins, The stat utility...

I noticed the page for STAT(1) says BSD General Commands Manual, while that for STAT(2) says BSD System Calls Manual, so maybe the number is a code for the type of command?

1
  • 2
    Have you checked the manual page for the man command itself (i.e. man man)? Commented Sep 1, 2014 at 14:22

2 Answers 2

3

The number is a "section" there are several sections. Usually

1 is General command
2 is System calls
3 is functions (for example in C)
4 is Special Files
5 is File Formats (think config files)
6 is misc.
7 is system commands

The reason is that a "term" may be in many sections. ftp is a command, could be a daemon and might have a config file.

So stat(1) is saying the general command stat, while stat(2) is saying the system call stat. It can be confusing. For normal usage usually you only see 1 and 5. 3, for example is filled with C function calls and such.

2
  • 8 is system commans, 7 is device, see man 7 intro
    – Archemar
    Commented Sep 1, 2014 at 14:45
  • it's system dependent.
    – coteyr
    Commented Sep 1, 2014 at 15:09
1

In the "good old days", man pages were printed and came with the mainframe/mini computers (took all of them home to read at one point). They came in volumes organized by usage: command, system command, library call, system call, file format, etc. The man(1) page shows the volume names. To view a page from a specific volume, you would put that on the command line before the manpage name: To see stat(2), you would run man 2 stat. Otherwise it takes the first volume that the name is found in, stat(1). To find if there are multiple entries in different volumes, you can use apropos -e stat.

Not the answer you're looking for? Browse other questions tagged .