Fuller discussion of Unix command syntax



Last revision August 6, 2004

Table of Contents:
  1. Shell interpretation
  2. Editing command lines
  3. Stuck in a Unix login session?
  4. Program execution
  5. Simple commands
  6. Unix command syntax
  7. Controlling processes
  8. Your login environment

The general syntax for Unix commands is:

programname options expressions filenames

Options are usually in the form of a hyphen (-) followed by a single character. Multiple options can usually be specified either by multiple hyphen-character tokens, for example, -l -t, or by one hyphen followed by a string of characters (no embedded blanks), for example, -lt.

Some options require additional information, either a string immediately contiguous with the option, for example, -Pprinter, or a blank after the option followed by the additional information, for example, -f /dev/rmt0h.

Some locally written Earth Sciences programs follow an alternate standard of specifying additional information options with a keyword=value sequence (no spaces around the equals sign). Many common GNU (Free Software Foundation) public domain programs also use the keyword=value syntax for options, or use doubled hyphens (--) followed by a full option name, rather than a single letter option character.

In general, order of arguments to the program is important.

Some commands want an expression, for example, a string of characters to look for in a file.

Most commands work with files, and generally allow more than one filename to be specified, to be processed in order.

Remember, the shell breaks up the line you type into the arguments for the command using blanks or tabs as delimiters. To embed a blank in an argument to a program, enclose that argument in quotes.

<--Previous Overview Next-->

Comments or Questions?