man (view reference manuals)

If you need in-depth information on the usage of a command, for instance a list of all options, use man:

man PROGRAM

This will invoke PROGRAM's manual page. Every Linux program comes with a man page. Some configuration files have a man page, too (try man group, for example), and there are pages on special topics that are not associated with a command or file. Man pages are the most reliable source of information you can get, but they tend to be lengthy and hard to understand.

Shell built-in commands such as alias, cd or bg do not have man pages of their own. They are documented in a page called “builtins”:

man builtins

Linux's man pages are organized thematically in nine sections. To mention just a few examples, Section 1 contains information on executable programs, Section 5 deals with file formats and conventions, and Section 7 covers miscellaneous topics.

Sometimes the same keyword exists in multiple sections, which can be confusing for beginners. For example, when I type man regex on my system, I get to see the man page of a programming interface, although I usually want to get information on regular expressions. You can use →apropos to display the manual sections that treat a particular topic. In this case:

apropos regex

This provides the following information on my system:

regex (3) - POSIX regex functions

regex (7) - POSIX.2 regular expressions

Sections 3 and 7 each have a man page on the keyword regex. The page that gives general information on regular expressions is in Section 7. To display it, enter:

man 7 regex

You'll rarely have to specify the section number of a man page, but sometimes it's necessary.