Number in man page titles e.g. sleep(3)

Quick primer
It has been reported that a popular "TIL" post linked from Hacker News dug into a tiny but persistent mystery for anyone who’s used Unix man pages: what do the numbers in names like sleep(3) or read(2) actually mean? The discovery was prompted by a pull-request review comment — the reviewer wrote, "nit: it’s not a syscall, so ‘man 2’ is incorrect" — and the author chased it down via the venerable man man page (yes, man man).
What the numbers mean
The numbers are simply manual-section identifiers. Section 1 lists executable programs and shell commands; section 2 documents system calls (kernel-provided functions); section 3 covers library calls (functions in libc and other libraries). So basename(3) is a library function and should be cited as man 3 basename, not man 2. Handy sites like man7.org or linux.die.net mirror this information if you prefer a browser to the terminal.
Suffixes and quirks
There’s more nuance: letters can be appended to the numbers. For example, p marks POSIX pages (free(3p)) and x indicates X Window System documentation (ncurses(3x)). The full table in man(1) also lists less-common sections and conventions — Unix has always been big on taxonomy.
Why it matters
Small conventions like this trip up surprisingly experienced folks. It’s a reminder that the command line still has lore worth learning — and that a nit in a code review can teach you something useful. Want to sound like you belong in an old-school systems codebase? Learn your sections. It’s the little details that make a reviewer smile (or reach for the red pen).
Sources: lalitm.com, Hacker News
Comments