33

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

43

Use:

apropos .

or:

man -k .

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

  • 3
    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
  • neither of those work in cygwin for me – Wyatt8740 Jun 18 '16 at 22:03
9
$ man -k . -s <section-NR>

For example to show all section 2 pages:

$ man -k . -s 2
  • I was hoping man 2 -k '.' would work as well. But it doesn't – abc Aug 7 '14 at 22:45
  • Try again and specify the section after option -k as indicated above ... – Aaron Sep 11 '14 at 15:17
  • This answer is definitely more useful – Lucius Hu Jun 18 at 7:14
  • Specifying the section number doesn’t work for me. – OregonTrail Jul 8 at 20:14
3

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 .
2
# 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}'
  • 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
  • @cYrus or just modify it to man -k . | awk '{print $1,$2}' to keep the section – villapx Apr 11 '18 at 13:17
0

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

  • 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
0

On macOS, you can use

man -k .

or

apropos .

or

whatis .

However, on macOS, the man -k, apropos and whatis commands do not support filtering by section.

So, you can use the following pipeline to do that

man -k . | grep \(1\) | less

You can replace 1 with the manual section of your choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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