List available man page sections for an application
With the man
from man-db
at least:
$ man -f open
open (2) - open and possibly create a file
open (1) - start a program on a new virtual terminal (VT).
open (3tcl) - Open a file-based or command pipeline channel
open (3perl) - perl pragma to set default PerlIO layers for input and output
Same as:
$ whatis open
open (2) - open and possibly create a file
open (1) - start a program on a new virtual terminal (VT).
open (3tcl) - Open a file-based or command pipeline channel
open (3perl) - perl pragma to set default PerlIO layers for input and output
Or to get the paths of the man pages:
$ man -wa open
/usr/share/man/man1/openvt.1.gz
/usr/share/man/man3/open.3tcl.gz
/usr/share/man/man2/open.2.gz
/usr/share/man/man3/open.3perl.gz
To read all the man pages on a given topic, man -a
is very common.
Note however that some implementations run one instance of the pager for each man page (you need to quit the pager to get to the next man page and there's no coming back), while some others pass the man pages as separate arguments to a single pager invocation (and you use :n
, :p
for instance with the less
pager to navigate through the pages).
One option:
apropos fork
to limit to exact word:
apropos -e fork
Alternatively, as apropos uses regex by default:
apropos "^fork$"
Alternatively use man -k
instead of apropos
.
Check out man pages for apropos and man for more details.
If you're man
is from the "man-db" package, you can invoke this to see the "intro" page for each section of the manual:
man -a intro
If you know the location of the man
pages database, this will list all of the section directories (man1, man2, man3, etc):
(cd /usr/share/man; ls -d man*)
Also if using man
from the man-db
package, you can see the location of the man pages database(s) by invoking man -w
(this option also exists on FreeBSD man
, but I don't have it installed so I don't know if it gives the same output). For example, on Debian 8 (jessie):
$ man -w
/usr/local/man:/usr/local/share/man:/usr/share/man
Using man -w
, a simple script to list all of the section numbers available in all of the man database directories would be:
#!/bin/sh
IFS=":$IFS"
for i in $(man -w)
do
(
cd "$i"
for j in man*
do
if [ -d "$j" ]
then
echo "${j#man}"
fi
done
)
done | sort -u