[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 3 Getting Started

3.2 Unix Command Line Structure


A command is a program that tells the Unix system to do something. It has the form:

command [options] [arguments]

where an argument indicates on what the command is to perform its action, usually a file or series of files. An option modifies the command, changing the way it performs.

Commands are case sensitive. command and Command are not the same.

Options are generally preceded by a hyphen (-), and for most commands, more than one option can be strung together, in the form:

command -[option][option][option]

e.g.:

ls -alR

will perform a long list on all files in the current directory and recursively perform the list through all sub-directories.

For most commands you can separate the options, preceding each with a hyphen, e.g.:

command -option1 -option2 -option3

as in:

ls -a -l -R

Some commands have options that require parameters. Options requiring parameters are usually specified separately, e.g.:

lpr -Pprinter3 -# 2 file

will send 2 copies of file to printer3.

These are the standard conventions for commands. However, not all Unix commands will follow the standard. Some don't require the hyphen before options and some won't let you group options together, i.e. they may require that each option be preceded by a hyphen and separated by whitespace from other options and arguments.

Options and syntax for a command are listed in the man page for the command.


Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]