0

I have a question regarding linux man pages folder organization/structure as it appears in the output of the command below:

[root@centos8 man]# pwd
/usr/share/man
[root@centos8 man]# ls -d ./man*
./man0p  ./man1p  ./man2   ./man3   ./man3x  ./man4x  ./man5x  ./man6x  ./man7x  ./man8x  ./man9x
./man1   ./man1x  ./man2x  ./man3p  ./man4   ./man5   ./man6   ./man7   ./man8   ./man9   ./mann 

Why are there so many folders? For example, what is man0p, man1p, man2 and man2x?

Thanks.

Quasímodo
  • 18,865
  • 4
  • 36
  • 73

3 Answers3

2

Like noted above, there's a question about what the numbers means with a very good answer already.

With respect to suffixes (e.g., the x in man2x), the Wikipedia article on man pages includes:

Some sections are further subdivided by means of a suffix; for example, in some systems, section 3C is for C library calls, 3M is for the math library, and so on. A consequence of this is that section 8 (system administration commands) is sometimes relegated to the 1M subsection of the main commands section. Some subsection suffixes have a general meaning across sections:

Subsection | Description
-----------|------------------------------
p          | POSIX specifications
x          | X Window System documentation

(Section 3 tends to be the exception with the many suffixes for different languages.)

So, man3x would be C Library Functions for the X Windows System.

Andy Dalton
  • 13,993
2

And in general:

  1. User commands
  2. System level function calls
  3. Library functions
  4. Protocols
  5. Configuration Files
  6. Games
  7. Miscellaneous Information
  8. System commands

Some systems have internal kernel routines in section 9.

You might also see 3pm pages, these are Perl modules, and I just discovered 3am pages, which seems to be GNU awk extensions! Fun.

Hack Saw
  • 1,024
0

Just to add some accessibility information to the above, you can see the manifestation of the man pages directory structure by adding a section number to your command when calling up a man page.

For example, running man printf on Linux brings up the User Commands man page for the printf utility in section 1 of the man pages. On BSD man printf brings up the analogous BSD General Commands Manual man page for printf in section 1.

Alternatively if you run man 3 printf on Linux you'll get the Linux Programmer's Manual man page for the printf family of functions in the C programming language in section 3 of the man pages. On BSD man 3 printf brings up the analogous BSD Library Functions Manual man page for the C printf functions in section 3.

When just running man foo the man utility will begin its search in section 1, and proceeds through to higher numbered sections until it either finds the man page for foo, or exhausts the search. You can see what section a man page is in by looking at the first line of the man page. In the upper right or left you'll see foo(N) where N is the section number, corresponding to the directory structure of the man pages.

In contrast to running man foo and searching through all sections until the first hit, running man N bar where N is the targeted section, will restrict the search to just that section.