Search which man sections contain a given entry

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.


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).


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.