Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to generate a list of all available man pages on a system?

share|improve this question
1  
type "man man" it will set you free. –  Chris Nov 5 '10 at 13:52
add comment

5 Answers 5

up vote 12 down vote accepted

Use:

apropos .

or:

man -k .

where . is a regex that means: "any character".

share|improve this answer
    
Also handy: apropos -s 1 . to limit it to section 1 (user commands), for example. –  Dennis Williamson Nov 5 '10 at 16:19
    
I was going to suggest looking at how bash and zsh provide completion, but this is a lot simpler (less portable though, as not all systems accept a regexp as the argument to apropos). –  Gilles Nov 5 '10 at 20:42
add comment

Look in the paths listed in /etc/man.config, with the additional directories as added by the FHS or FSSTND directive as appropriate.

share|improve this answer
    
And then? I think it's better to read paths from MANPATH variable. But it's awful, because there is a huge number of subdirs and it contains different file extensions like 1 or gz. By the way, many systems have no man.config in /etc –  psihodelia Nov 5 '10 at 13:43
1  
@psihodelia: On my system it's /etc/manpath.config and $MANPATH is null. –  Dennis Williamson Nov 5 '10 at 16:24
add comment
# Shell script to list pathname of all available man pages  
mandirs="\`man -w | sed 's/:/ /g'\`"  
find $mandirs -type f  

This produces a list of all man files, using the list of man directories that is produced by "man -w", however, cYrus's any-character-regex solution is much better, pipe though awk to get a clean list of just the page names:

apropos . | awk '{print $1}'

or

man -k . | awk '{print $1}'
share|improve this answer
1  
That way you'll loose the man section and thus create duplicates. For the latter pipe through sort -u. –  cYrus Nov 5 '10 at 14:54
add comment

Here's my favourite:

whatis -r .

… and if you just want to see all the man pages in a particular section use the -s flag.

For example, if you just wanted to get a list of all man pages for all executable commands (section 1):

whatis -s 1 -r .
share|improve this answer
add comment
$ man -k . -s <section-NR>

For example to show all section 2 pages:

$ man -k . -s 2
share|improve this answer
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.