The Better To RTFM

Published on January 26, 2012 by Jesse Storimer

Unix manpages are great if you already know what you're looking for. But what if you don't?

If you've read prior art on manpages then you know that the manpages are separated into sections: section 1 is for general commands, section 2 is for system calls, etc. If you know exactly what command or system call you're looking for then it's easy to look it up: man grep finds the grep documentation. Here's some tips to dig a little deeper.

1. Each manpage section has its own intro page.

The intro pages provide an overview about each section. Try man intro for an example. For something of more interest try man 2 intro. Believe it or not that's probably one of the most concise and to the point introductions to systems programming that I've seen. Unless you knew you were looking for that it's kind of hard to find.

Contrary to man man, which provides information about how to use the man command, intro pages provide general info about the documentation itself. Very useful.

2. You can search the manpages.

There are two commands for this purpose: whatis(1) and apropos(1). The whatis command searches for exact matches in the manpage database. The apropos command searches for partial matches. Want to know which variants of grep you have documentation for?

$ whatis grep

This will return a few manpages with the whole word 'grep' in the name.

$ apropos grep

This will return more manpages than before, this time including some that have grep as a substring. This includes stuff like zgrep(1), pgrep(1), etc.

The good news is that you don't need to remember any extra commands to search the manpages: just use man -k search-string. man -k is equivalent to apropos(1).

$ man -k grep

3. Some interesting manpages you probably didn't know about.

intro(2). signal(7). environ(7). style(9).

Go forth and RTFM.

I'm Jesse Storimer. Follow me on Twitter.

For a more comprehensive introduction to systems programming try my book: Working With Unix Processes.

Like what you read?

Join 2,000+ Ruby programmers improving their skills with exclusive content about digging deeper with sockets, processes, threads, and more - delivered to your inbox weekly.

I'll never send spam and you can unsubscribe any time.

comments powered by Disqus