Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

A man page for fork, for example, is in the System Calls section that has number 2:

man 2 fork

How do you see what else is section 2 without resorting to Google?

share|improve this question
    
Without google, but via web, go to man7.org/linux/man-pages/dir_section_2.html (or main page here: kernel.org/doc/man-pages ) –  belacqua May 13 at 23:41
add comment

2 Answers 2

up vote 13 down vote accepted

Manpages are usually placed in /usr/share/man, but check $MANPATH, and are organized into sections like so:

 Section 1:
 /usr/share/man/man1/

 Section 2:
 /usr/share/man/man2/

 ...

So to list all installed section 2 manpages, do:

ls /usr/share/man/man2/

Or the more complete one:

find $(echo $MANPATH | tr ':' ' ') -path '*/man2/*'

The latter one will have problems if you have directories in $MANPATH with space in their names.

On most distributions you can also check available man pages with a package tool, e.g. on Debian derived distributions you can use apt-file like so:

apt-file search /man2/
share|improve this answer
1  
Thanks - This was the start I needed. I made a shell function that is run e.g. lman 2 and lists the unadorned name for each page on a new line and pages them. The function's body is: find $(man --path | tr ':' ' ') -path "*/man$1/*"| xargs basename | sort | sed -E "s/\.$1(.gz)?\$//" | less –  xyz Jul 30 '12 at 21:41
add comment

To list all installed man pages from a specific section you can use apropos:

apropos -s 2 .  # use an regex for apropos . means anything
apropos -s 2 -w '*'  # use unix globbing for apropos
share|improve this answer
    
"apropos: -s: unknown option" –  Michael Mrozek Jul 30 '12 at 20:36
    
@MichaelMrozek what system are you using? It works for me, e.g: output of apropos -s 2 -w '*' –  Ulrich Dangel Jul 30 '12 at 20:42
    
Thanks. The -s option is not present in Mac OS X apropos, which is presumably from BSD. –  xyz Jul 30 '12 at 21:09
    
@f100 Ah ok, maybe try man -a -s 2 '*' –  Ulrich Dangel Jul 30 '12 at 21:16
    
That seems more like it, but instead of listing them, it's actually invoking the viewer for each one in turn. I've hacked up a function to do listing which I posted in another comment. It likely has issues but it's enough for me :) –  xyz Jul 30 '12 at 21:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.