Viewing Linux Programmer’s Manual when multiple pages bear the same name

command lineman

I want to view the read page of the Linux Programmer's Manual. When I type man read I get the read page of the General Commands Manual.

Looking at the man --help I realized I could view all man pages for a query but that entails viewing them all one by one until I hit the one I'm looking for. Not really efficient.

How can I specify which manual I want to query?

Best Answer

If you already know the section of the manual page you want to view, you can pass that as a parameter to man. For example, to view the manual page for read in section 2:

man 2 read

The sections are as follows (this list taken from the manual page for man itself):

  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 conventions), e.g. man(7), groff(7)
  8. System administration commands (usually only for root)
  9. Kernel routines [Non standard]