A Short Guide To Using Linux Man Pages

Linux man pages remain the best source of information for using Linux command line tools. You don’t need an internet connection to instantly get a description of how a utility works and an explanation of all of it’s flags, options and syntax.

Using a man page is as simple as running:

man <COMMAND>

The problem is that quickly parsing all the information is difficult. These tips will make your life more efficient whenever you turn to man for information.

Command Syntax

The command syntax is the order in which you need to type the various parts of a command to get it to run. This is sometimes not obvious when you try a command.

The syntax is spelled out at the beginning of the man page in the SYNOPSIS section.

This information is always at the top of the man page. Here is the syntax for rsync:

rsync [OPTION...] SRC... [DEST]

This tells you that first enter rsync next the options, then the SRC or source files, and finally the DEST or destination which is where you want the files to go.

Searching

When you run man the information is displayed in a pager. The default found on almost 100% of Linux systems is less. less comes with lots of helpful features that you can use when you are reading a man page.

Firstly, you can always access the help information by hitting h in the man page.

Search forward

This search will start from the cursors current location to the end of the man page. Just enter:

/

Followed by your search term then hit ENTER. Here --delete is searched for:

/--delete

The man page will jump to the first instance of --delete and highlight it.

Jump to the next match by pressing n. You can keep hitting n until you reach the end of the man page. If you want to go back to the previous match hit N.

Search backwards

Pess:

?

To search from cursor’s position backwards towards the top of the man page.

Search multiple patterns

If you want to search for either patter1 or patter2 separate the search terms with the | character:

/color|colour

Jumping to the top or bottom

If you need to get to the top the man page press:

g

And to get to the bottom press:

G

Configuration Files (man 5)

man pages not only explain Linux commands but also their configuration files. man has various sections, the default is 1 while 5 is for configuration files.

Access section 5 as follows:

man 5 <COMMAND>

E.g.:

man 5 locale

There is also commonly a man page for specific configuration files which will tell you all the available configuration options e.g.

man locale.conf

Pipe man to standard output

If you want to dump a man page into a file you can redirect it as you would expect:

man rsync >rsync-man-page.txt 

Or you can use grep or other command line tools you just have to use the | to do so e.g.:

man rsync | grep "delete"