5.1.1 Describing the Command Line

Note: You can skip this section if you want to move on.

There’s a traditional, concise way of describing command _syntax.

Syntax_ means the correct ways to combine various options and

arguments. For example, if you type man man to get the manual page

about man, you’ll see several syntax descriptions beginning with the

command name man. One of them will look like this: man -k [-M path]

keyword ...

Anything in brackets ([]) is an optional unit. In this case you

don’t have to use the -M option, but if you do, you must use a path

argument. You must use the -k option and the keyword argument. The

... means that you could have more of whatever came before it, so

you could look up several keywords.

Let’s look at one of the more complex descriptions from the man

manual page:

man [-c|-w|-tZT device] [-adhu7V]

[-m system[,...]] [-L locale] [-p string]

[-M path] [-P pager] [-r prompt] [-S list]

[-e extension] [[section] page ...] ...

There’s no need to go through all of this (and don’t worry about

what it all means), but do pay attention to the organization of the

description.

First, clusters of options usually mean you can use one or more of

them in different combinations, so -adhu7V means you can also use

-h. However, you can’t always use all combinations; this description

doesn’t make that clear. For example, -h is incompatible with other

options, but you could do man -du. Unfortunately, the description’s

format does not make this clear.

Second, the | symbol means “or.” So you can use the -c, the -w, _or_

the -tZT option, followed by a device argument.

Third, notice that you can nest the brackets, because they indicate

optional _units_. So if you have a section, you must also have a

page, because e page is not optional within the [[section] page]

unit.

There’s no need to memorize any of this, just refer to this section

as you read documentation.

Debian GNU/Linux : Guide to Installation and Usage · 第 80 / 193 题