We’ve already discussed the command line—that is, commands you type
after the shell prompt. This section describes the structure of more
complicated command lines.
A minimal command line contains just a command name, such as whoami.
But other things are possible. For example, you might type: man
whoami. This command requests the online manual for the whoami
program (you may have to press the space bar to scroll through the
documentation or press q to quit). A more complicated example is man
-k PostScript. This command line has three parts. It begins with the
command name, man. Then it has an _option_ or _switch_, -k, followed
by an _argument_, PostScript. Some people refer to everything except
the command name as the _parameters_ of the command. So, options and
arguments are both parameters.
Options change the behavior of a command, switching on particular
features or functionality. They usually have a - before them. The
GNU utilities also have “long forms” for the options; the long form
of -k is -apropos. You can enter man -h or man -help to get a full
list of options for the man command. Every command will have its own
set of options, though most have -help and -version options. Some
commands, such as tar, do not require the “-” before their options
for historical reasons.
Anything that isn’t an option and isn’t the command name is an
_argument_ (in this case, PostScript). Arguments can serve many
purposes; most commonly, they are filenames that the command should
operate on. In this case, PostScript is the word you want man to
search for. In the case of man whoami, the argument was the command
you wanted information about.
Here’s a breakdown of the man -k PostScript command line:
man. The command name, tells the computer to look at the manual
pages. These provide documentation for commands. For example, man
whoami will give you documentation on the whoami command.
-k. The option, changes the behavior of man. Normally man expects a
command name, such as whoami, for an argument and looks for
documentation of that command. But with the -k or -apropos option,
it expects the argument to be a keyword. It then gives a list of all
manual pages with that keyword in their description.
PostScript. is the argument; because we used the -k option, it’s the
keyword to search for.
-k and PostScript are both parameters.
Go ahead and type man -k PostScript, and you will see a list of all
the manual pages on your system that have something to do with
PostScript. If you haven’t installed much software, you might see
the message PostScript: nothing appropriate instead.