Man pages

From Linux 101, The beginner's guide to all things Linux.

Jump to: navigation, search

Contents

[edit] What is a man page?

man is short for "manual," and the man pages represent the help system of all things linux and computers. Usually, for each program on your system, the developers also supply a man page for it that describes in high detail exactly how to use the program, and what options you can tell the program to run with. In fact, man pages go far beyond telling you how to run programs, man pages exist for the following:

    1. Commands
    2. System calls
    3. Library calls
    4. Special files
    5. File formats and conversions
    6. Games for Linux
    7. Macro packages and conventions
    8. System management commands
    9. Kernel routines

The man pages form a robust collection of knowledge.

[edit] Accessing man pages

It is very simple to view a man page. At a terminal, type:

man <what-you-want-to-know-about>

and the man page appears before your very eyes!

[edit] Navigating the man page

the man page viewer follows the vi or vim standard on how to move around, but for simplification, I'll explain the very basics here for you.

The arrow keys will move you around. So you can read up or down into the article.

The 'q' key on the keyboard will quit the man page viewer and return you to the terminal.

If you wish to search for a word or phrase, simply type /pattern and then hit enter. For example, if I wish to search for the word "fstab" in the man page, I would type on my keyboard /fstab<enter>

To move to the next search result, hit the n key (n for next!). To search in the opposite direction (ie, go to the previous result you were just at), you can hit the N (shift-n) key.

[edit] Reading Command-line Arguments

This is pretty much a standard and remembering it will be well worth your time!

Command-line arguments are usually shown with:

  • [ and ] markers
  • < and > markers
  • no markers

If the square brackets are used, it means the options listed inside are completely optional. You do not need to run the program with them, but it may do something in particular that you find useful.

If the less than/greater than symbols are used, it means that not all options listed are necessary but usually you want at least one of them. For example, this might choose a mode of the program (decompress as opposed to compress)

If no markers are used, then it is a required command-line argument.

For example, you may see a program listed as program <options> filename means that the program expects you to put the options before the filename.

[edit] Man pages with the same name

Usually it is not a problem, but sometimes man pages have the same name. For example, in the list above there is both a command named free (section 1) and a library call of free() in programming (section 3).

If you type man free it will look in section 1, then 2, then 3, and so forth for a man page on your topic. In this case, you will read about the command free. If you want to read about the library call, then you need to tell man what section it is in, and you do so by:

man <section> <pagetitle>

For our example, we would use:

man 3 free

[edit] Getting help beyond man pages

Man pages sometimes are written by very technical writers and they are very succint. Sometimes this can be frustrating, since you feel like you're reading a document written in 1974 and it is completely not getting through.

At this point, you need to look for outside help, because usually it is a sign that you're not understanding a concept.

  • Post questions on Linux 101's discussion pages. Each article has a discussion page (link at the top of the page). Use them to your advantage.
  • Search google or look for a forum (we have forums on our website). No matter what question you have, it is near certain someone else has asked it before.
  • Try our IRC channel.
Personal tools