Viewing and Searching Man Pages

As you already probably know, man is the command line program which is used to display Linux manual pages (manpages) which are program reference documents stored locally.

At its most basic usage, to view a manpage, simply type man followed by the program you want to view the manpage for. The below example opens the manpage for chown.

man chown

Some basic movement and search keys (not that there are tons of other keybindings if you enter any man page and hit h):

Move down:

  • ↓, j     # moves down one line
  • d     # moves down half a page
  • f     # moves down a full page
  • G     # moves down to the bottom of the document

Move up:

  • ↑, k     # moves up one line
  • u     # moves up half a page
  • b     # moves up a full page
  • g     # moves up to the top of the document


  • /string     # searches forward for string
  • /string     # searches backward for string


  • q     # close the manpage

One of the first things that you’ll notice when entering the manpage for chown is in the upper corners, it says CHOWN(1). This is telling you that you are reading the manpage for chown in section 1. chown also has a manpage in section 2, which is accessible with the following command:

man 2 chown

Note that there are 8 different sections, each of which corresponds to a different part of the system:

  1. General commands
  2. System calls
  3. Library functions
  4. Special files
  5. File formats
  6. Games and screensavers
  7. Miscellaneous
  8. System administration commands and daemons

Intro has a man page in each section, and is accessible by simply specifying which section man page you want to use:

man 1,2,3,...,8 intro

Two other uses of man have equivalent utilities themselves.

The first one displays a short description from the manpage:

man -f

The second one searches the short description from the manpage for keywords:

man -k

As an example, the whatis command below will tell you the short description for the program zip, while the apropos command will search all the manpages for the keyword zip.

whatis zip
whatis zip

whatis zip

apropos zip
apropos zip

apropos zip

While it may not be precisely proper usage, don’t forget you can use grep to find and search within manpages as well. For example, the below command searches for the case-insensitive keyword, archive in the manpage zip, then prints the line before the keyword match as well as three after the match.

man zip | grep --color=always -B 1 -A 3 archive | less -R

The output looks something like this:

manpage grep searching

manpage grep searching

Note that I used –color=always and the -R switch on less to enable color highlighting within less, and used less itself in order to more easily scroll through the matches.

I hoped all this helped you learn more about manpages!

Tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

Protected by WP Anti Spam