Browsing Command Documentation on *nix systems

While trying to figure out which process on my Mac controls the sync process to the phone, I was trying to figure out how to get a list of all the system daemons and agents. It turns out that they (well most of them) are in the man pages. man has a nice whatis feature that gives the name of the command and a brief one-line description of it, but I wasn’t sure how to dump a list of everything it knows about. As it turns out, you can use regular expressions, which makes it very easy.

This works for MacOS and Linux (and pretty much any system that is man based).

There are generally 9 broad sections of the types of documentation.

For linux, the sections are:

   1   Executable programs or shell commands
   2   System calls (functions provided by the kernel)
   3   Library calls (functions within program libraries)
   4   Special files (usually found in /dev)
   5   File formats and conventions, e.g. /etc/passwd
   6   Games
   7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7), man-pages(7)
   8   System administration commands (usually only for root)
   9   Kernel routines [Non standard]

And for MacOS:

       1.   General Commands Manual
       2.   System Calls Manual
       3.   Library Functions Manual
       4.   Kernel Interfaces Manual
       5.   File Formats Manual
       6.   Games Manual
       7.   Miscellaneous Information Manual
       8.   System Manager's Manual
       9.   Kernel Developer's Manual

So to list all the commands that man knows about for section 8, use the following command:

man -k -S 8 '.*' | sort | uniq | less

You can, of course, leave out the section, and that will list everything, which is quite a long list.

Leave a Comment