12

I'm new with Linux and have noticed that there are numbers beside certain commands I look up.

For example I want to look up accept() in the aspect of network programming, but man accept shows this instead:

accept(8)                   Easy Software Products                   accept(8)

NAME
       accept/reject - accept/reject jobs sent to a destination

So how do you switch between manual pages to other numbers like accept(1) ~ accept(7)?

bwDraco
  • 45,747
  • 43
  • 165
  • 205
Some Noob Student
  • 1,927
  • 3
  • 15
  • 12
  • 2
    Nowadays you can read manpages on the web too: http://linux.die.net/man/ – ott-- Nov 13 '11 at 21:14
  • @ott Also, Google Chrome has a man pages plugin, so one can type "man popen" and it will automatically load the relevant man page from an online source (eg linux.die.net). – new123456 Nov 13 '11 at 22:21
  • 4
    @ott--: Yes, but any man pages on the web aren't necessarily in sync with the software on your system. – Keith Thompson Nov 13 '11 at 23:03
  • 6
    The `man` command has its own man page; typing `man man` would have answered this and many other questions. – Keith Thompson Nov 13 '11 at 23:04

5 Answers5

20

To find out which sections are available, use whatis manpage. Example:

$ whatis unlink
unlink (2)           - delete a name and possibly the file it refers to
unlink (1)           - call the unlink function to remove the specified file

To view the manual page in question, use man section manpage, e.g.:

man 2 unlink

Using the -a option, you'll be able to show all sections of a manpage:

man -a unlink

I haven't found a way to "switch" between manpages even though the pager less supports switching (:p and :n), the only supported actions using the -a option are "next", "skip" and "cancel".

When in doubt, you can also read the manual page of man:

man man
Lekensteyn
  • 6,546
  • 5
  • 27
  • 48
17

The 8 referenced there isn't actually page 8, it is section 8. The sections are split like this:

Section     Description
1   General commands
2   System calls
3   C library functions
4   Special files (usually devices, those found in /dev) and drivers
5   File formats and conventions
6   Games and screensavers
7   Miscellanea
8   System administration commands and daemons

So the accept you are reading about is the system admin command.

If a command is in more than one section, you will be prompted for the one you want, or you can use:

man 8 accept

Where "8" is the section. This will target the specific man page section you are after.

Paul
  • 59,223
  • 18
  • 147
  • 168
  • 3
    I've never been prompted when a name is in more than one section--man has just shown me the first one. You can, though, use the -a option to be taken to all the pages of that name in sequence, or the -k option to see a list of all the pages containing that name in their short descriptions. – garyjohn Nov 13 '11 at 21:24
  • 1
    Thanks @Paul, this helps a lot! Is there a keyboard shortcut to simply switch between sections? – Some Noob Student Nov 13 '11 at 21:28
  • 1
    @Sheldon man is not GNU info - its just a program which prints out manual pages, and does not use a built in explorer. – new123456 Nov 13 '11 at 22:19
5

man 2 accept will display section 2, for example.

Mike Scott
  • 4,423
  • 1
  • 17
  • 17
4

FYI, For less-forgiving *NIX environments (Mac/Darwin, Solaris, AIX, ... ) may not accept

man 2 accept

you would need to use -S 2 instead:

man -S 2 accept
DouglasDD
  • 460
  • 1
  • 3
  • 10
2

The simplest way is to run

man -a name

This will show in sequence all the manual pages for "name" in all volumes where they appear.

jlliagre
  • 13,899
  • 4
  • 31
  • 48