Chapter 4: Getting help

Read manual pages

Nobody remembers every option of every command. Experienced administrators look things up constantly, and the first place they look is the system itself. Every package installs manual pages, man pages for short, that describe its commands and files, written for exactly the version installed.

Open a manual page

man followed by a name opens its manual page:

[student@workstation ~]$ man ls
LS(1)                            User Commands                           LS(1)

NAME
       ls - list directory contents

SYNOPSIS
       ls [OPTION]... [FILE]...

DESCRIPTION
       List  information  about  the FILEs (the current directory by default).
       Sort entries alphabetically if none of -cftuvSUX nor --sort  is  speci‐
       fied.
...

The page opens in less, so the keys you learnt in chapter 2 work here:

KeyDoes
Space / bNext / previous screen
d / uDown / up half a screen
↓ / ↑One line
/text EnterSearch forward; n next match, N previous
g / GStart / end of the page
qQuit

The parts of a page

Pages follow the same layout, though few use every heading:

HeadingWhat you find there
NAMEThe name and a one-line description
SYNOPSISHow to call it: the command line's shape
DESCRIPTIONWhat it does, and usually the options
OPTIONSThe options, when not in DESCRIPTION
EXAMPLESWorked examples: often the fastest way to the answer
FILESFiles it reads or writes, such as configuration files
SEE ALSORelated pages, with their section numbers

Sections: one name, several pages

The manual is divided into numbered sections. The ones an administrator uses most are 1, 5 and 8:

SectionHoldsExample
1Commands any user runsls(1), passwd(1)
2System calls (for programmers)open(2)
3Library functions (for programmers)printf(3)
4Special files, mostly devicesnull(4)
5File formats and configuration filespasswd(5), fstab(5)
7Overviews, conventions, standardsregex(7), hier(7)
8Administration commands, usually for rootuseradd(8), mount(8)

That is why pages are written as passwd(5): the name plus the section. passwd(1) is the command that changes passwords; passwd(5) describes the /etc/passwd file. man passwd opens the first match, section 1. Put the section number first to choose:

[student@workstation ~]$ man 5 passwd
passwd(5)                     File Formats Manual                    passwd(5)

NAME
       passwd - password file

DESCRIPTION
       The  /etc/passwd file is a text file that describes user login accounts
...
       Each line of the file describes  a  single  user,  and  contains  seven
       colon-separated fields:

           name:password:UID:GID:GECOS:directory:shell

whatis lists every page with a name, one line each, so you can see which sections exist:

[student@workstation ~]$ whatis passwd
passwd (5)           - password file
passwd (1ossl)       - OpenSSL application commands
passwd (1)           - update user's authentication tokens

1ossl is a sub-section that OpenSSL uses for its own commands.

Read a SYNOPSIS line

The SYNOPSIS uses a small set of conventions to say what you may type. Select each part of these two real examples:

Reading a SYNOPSIS line: Select a convention below to highlight where it appears in the two command lines.

NotationMeans
bold or plain wordType it exactly as shown
underlined or CAPITALSReplace with your own value: a file name, a user name
[ ]Optional
...May be repeated
{a|b} or a|bChoose exactly one

Some commands have several SYNOPSIS lines: each is a different way to call them. cp can copy one file to a new name, or several files into a directory:

SYNOPSIS
       cp [OPTION]... [-T] SOURCE DEST
       cp [OPTION]... SOURCE... DIRECTORY
       cp [OPTION]... -t DIRECTORY SOURCE...

Check your understanding