Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Linux (or any other OS that uses the man tool), there are typically several sections of the manual. Often, a given entry (such as echo or printf) exists in multiple sections, but not all of them. Is there a simple way to check which sections of the manual that entry can be found in?

Obviously, one can try man [section] [entry] and just run through every section in the manual, but honestly, I'm not even sure what the complete list of sections is (or how to find that definitively), and I'm looking for something a little less brute-force.

share|improve this question
up vote 1 down vote accepted

Try whatis (eg, whatis printf). The sections of man are not random. See Wikipedia: Man page. For example, section 2 contains only System calls while section 3 only contains C Library calls. There is a version of printf for use on the command line so it is located in section 1. But there is also one in the C Library so that is located in section 3.

You will have to create the whatis database first with makewhatis -w (on Cygwin, it is in /usr/sbin).

share|improve this answer
Thanks for the tip! Unfortunately, whatis returns either nothing appropriate or manpath is null (despite that it isn't) on the systems I'm using right now. And I've read that Wikipedia page before, but as it makes clear, different systems have different sections, and I'm not sure how to check which ones are present except by brute force. – patrickvacek Jan 10 '14 at 21:20
@patrickvacek, have to create the whatis database first with makewhatis -w (on Cygwin, it is in /usr/sbin). – Peon Jan 10 '14 at 21:37
Oops, now it makes so much more sense. Thanks! – patrickvacek Jan 10 '14 at 22:08

These work with FreeBSD man, with the man from Linux distributions and the likes of Debian Hurd, and even with Cygwin man:

man -a -f ${entry}

or, more cryptically but perhaps more usefully in shell scripts,

man -a -w ${entry}

Of course, you must have your whatis database populated correctly. With Cygwin, this doesn't happen out of the box, unlike with FreeBSD, Debian, and the like. One has to run makewhatis.

share|improve this answer
The latter (man -a -w) works beautifully for me with cygwin, but I'm still having trouble with my Linux systems... although I think that may be specific to those systems. But even on cygwin, the former (man -a -f) yields nothing appropriate (its own words). – patrickvacek Jan 10 '14 at 21:31
You didn't ask about Cygwin, and I didn't answer about Cygwin. Cygwin's man is a different beast. If you want Cygwin answers, it's best not to start a question with "On Linux" and tag it as [Linux]. – JdeBP Jan 10 '14 at 21:48
Sorry for any confusion; I only mentioned Cygwin because I turned to it after my lack of success with Linux (CentOS) systems. My question remains focused on Linux. I just tried the commands on an Ubuntu system and they worked beautifully. (And after creating the whatis database in Cygwin, even the man -a -f works, too.) Thanks! – patrickvacek Jan 11 '14 at 3:37

Your Answer


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.