Getting Started : Command Structure

The basic structure of a Unix command is:

command [options,...] [arguments,...]

where command is the name of the command. These are typically 2 or 3 characters long and are often very cryptic in their meaning.

options are generally single characters which in some way modify the action of the command. There may be no options or there may be several acting on the same command. Options are preceded by a hyphen () character, but there is no consistent rule among Unix commands as to how options should be grouped. Some commands allow a list of options with just a single hyphen at the beginning of the list. Other commands require that each option is introduced by its own hyphen.

Some options allow a value, often a filename, to be given following the option. Again, there is no consistent manner in which this is allowed, with some options requiring the value to be placed immediately following the option letter, while others expecting a space between the option letter and the value.

arguments are values or items upon which the command is to operate. These are often filenames, and depending on the command there may be none or several arguments.

Unix is case-sensitive throughout. The exact combination of upper and lower case letters used in a command, option or filename being important. For example, the options -p and -P in the same command will have different meanings.

Examples of Commands

The following examples show the use of commands, options and arguments. More complete examples are given in following sections describing specific aspects of Unix.

% date

displays the current date

% quota

displays the current status of file usage and quota for the current username.

% lpr filename

prints the specified file on the default printer

% lpr -Pqueue filename

prints the specified file on the named printer queue.

% passwd

changes the password associated with the username, prompting for the existing password and then the new one. Different rules governing password format will exist on different systems; on the OUCS machines, for example, passwords must be at least six characters long and cannot be from a standard English dictionary.

% logout

will close the session.