Post

HN
Hacker News

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

If you do Linux systems programming, you will have likely pored over man pages, either on the command line or, my personal preference, using the excellent man7.org or linux.die.net . I’ve always seen the numbers in sleep(3) and read(2) and idly wondered what they meant, but never actually bothered to look them up.

That is, until a review comment on a pull request:

reviewer: nit: it’s not a syscall, so β€œman 2” is incorrect

So I looked it up. The answer was in the man(1) page (also accessible via the delightful man man command):

The table below shows the section numbers of the manual followed by the types of pages they contain.

So my colleague was right and the code should have read // behaves like man 3 basename as basename(3) is a libc library call.