How to Easily Read a Linux Man Page

One of the most important skills you can learn as a Linux user is how to use a manual page, or “man page.”

This article will introduce you to those simple documents. You’ll learn how to open man pages and identify the contents inside, which will include special markings such as bold and underlined text alongside indicators such as ellipses (…) and brackets ([ ]).

Man pages are fairly easy to tackle, and your time is valuable, so let’s not waste another minute.

In whichever terminal you have on hand, type

to open a man page. If you want to open the page for xterm, a terminal probably on your system, type man xterm.

Man pages are sorted into sections. Sometimes you will find them listed with their section number, like “tty(4).” The section number here refers to the tty controlling terminal under the “Special files (devices)” section, which is part of the standard sections of man pages listed in the link in this paragraph.

Any time you see a listing like “tty(4),” you can reach that section by typing

The syntax man 4 tty will reach the page reference here.

If you ever want to see if a man page exists, try

like whatis xterm.

Suppose you don’t know what page you need, but you know you want to read about terminals. You can search for a keyword by first refreshing your manual page cache with the command

Then search with

The syntax man -k terminal is appropriate in this situation.

You can pipe long output into the text reader less by using

That will make it easier to scroll and search for items.

Speaking of text readers, you will probably find less‘s younger cousin, known as more, on your system. Bring up its man page with

It should look like the following image.

Man page for 'more'

The reason more‘s man page works well as an example is because of the syntax shown in its Synopsis section. It reads “more [options] file…”

While that may not look complex, the variations in text style and form are all important to that line.

Bold Text

Any text in bold means that you should type it exactly as shown. When using the more utility, you will need to type the word “more” at the beginning of every command.

Brackets

Text shown in brackets is optional. In more’s case, you can use options like -f to count logical lines or -c to paint lines instead of scrolling them. The beginning of a more command could then look like

or

Since those parameters are optional, you can omit them entirely.

Underlined or Italicized Text

Depending on your terminal’s capabilities, you will likely see underlined and italicized text in certain places. Sometimes such text may also be a different color. In any case, this type of text means you need to replace it with an appropriate argument.

In this example with more, you must replace “file” with a file name. more -c file.txt makes sense here.

Ellipses

An ellipsis shown after any argument — file... – or expression – [options]... – means that argument or expression is repeatable.

What you get with more in file... means that something like

is allowed. In this case more will read “text.txt,” print it to screen, allow you to scroll if necessary, and then take action on “anothertext.txt.”

Or

One other type of indicator you’ll see in man pages is the “|.” This symbol means “or,” and in a man page it shows you that, for instance, two options are not allowed together at once.

The more example used above doesn’t list any parameters as being exclusive, so there isn’t a relevant example to show for that utility. If you read a handful of other man pages, however, you will come across something like -a|-b, and that means you can use only -a or -b in a command.

You will also see various sections in man pages that repeat time and time again. Typically, you will see “NAME,” “SYNOPSIS,” “DESCRIPTION,” “EXAMPLES,” and “SEE ALSO” sections, all listed in capital letters for clarity. The “OPTIONS” and “COMMANDS” sections will often be present as well.

Most of the sections are self-explanatory in nature. You can typically start from the top of any man page and get a brief overview of its contents with the Name, Synopsis, and Description sections. Afterward, you can peruse its options and examples to get a look at common usage.

Terminals often use the less utility to read man pages, so you should be able to search for any phrase with /.

While man pages might not be fancy, they hold a wealth of information. Now that you’re primed with the basic syntax found in most man pages, you can easily make use of one the next time you’re stuck when using a utility.

Also, don’t forget that man man is your friend and will cover all the details not discussed here.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.