Wednesday, July 4, 2012

Generate all Linux command man pages in one shot

Just saw this today:

Linux man-pages: list of all pages, by section

Useful. It does not include most commands (i.e. binaries), though. It mainly covers system calls and C library functions. The site says that that is the case because most commands come with their own man pages.

If you want to create your own set of man pages for Linux commands or for Unix commands, you can easily do it with this short shell script:

export MAN_DIR=some_directory_name
for dir in $CMD_DIRS
    cd $dir
    for cmd in `ls`
        man $cmd >$MAN_DIR/$cmd.m

where CMD_DIRS has a list such as:

"/bin /usr/bin /etc /sbin /usr/sbin" in it.

That's typically one of the first things that I used to do when using a new Unix system :)

And then you can use:

vi *.m

to read them all  ...

Or use * instead of ls in backquotes.
Posted via mobile, sorry for any formatting issues.

- Vasudev Ram

No comments: