The Digital Research Initiative
The University of North Carolina at Chapel Hill

Part Two

Command Structure

To manage your files in UNIX, you should know some common commands and how to use them. First, however, some basics about command structure should be addressed.

A UNIX command has three basic parts:

  1. The command itself
  2. Flags
  3. Arguments
The sample command below illustrates these parts:

The first part, the command itself, tells the machine to run a specific program or process. This part is almost always one word and all lower-case. UNIX commands are often abbreviated forms of words. (For example, to remove a file, type rm.) For simple operations you generally only need to type the command itself to get the results you need, without the flags or arguments

The second part of a command is the flag(s), also known as options or switches. Flags are typed directly after the command itself and are generally one letter proceeded by a dash (-). Flags control the type of output generated by executing the command. For example, entering ls will list all the files in the directory you are currently in, but entering ls -l will list the files of the current directory, along all sorts of information about the file (creator, date of last modification, etc...).

The third part of a command is the argument, which is almost always the name of a file or directory. The argument identifies which file the command is going to modify, create, or use during execution. There can be more than one argument in a command, just as more than one file or directory may be affected.

To understand how this structure works, imagine that you are in Burger King, and you want to order a Whopper without lettuce, and you want to have your Whopper placed on a tray. If the cashier at Burger King only responded to UNIX commands, you would have to enter something like whopper -n tray (where -n is the option for "no lettuce.")


This site made by
eric
This site was created especially for students of the UNC School of Journalism's
JOMC 050 Class, and anyone else who may be interested.
For more information, please contactdaikat@email.unc.edu