The general conventions used for most UNIX commands are as follows:
$ command_name [-options] [arg1 [arg2 [argn]]]
The square brackets indicate optional item zones on the command line. Options immediately follow the command name and begin with a hyphen. Each option consists of a single character—usually a letter but possibly a number or another character. When used, arguments follow the options. The number of valid arguments is determined by the command being invoked. An example of a typical UNIX command is as follows:
$ rm -f core
The option shown is specified by the hyphen and the letter f. The option -f is then followed by one argument, the filename core in this case.
There can be several options used on a command line. An example using multiple options is
$ ls -l -u b*
The example uses the options -l and -u. In this case, the command argument is a wildcard filename.
Options can be grouped together behind a hyphen. The previous command is functionally equivalent to the following:
$ ls -lu b*
This ls(1) command demonstrates that option characters can be grouped following the initial hyphen character.
Some options accept arguments other than the command-line arguments already shown. Examine the following tar(1) command:
$ tar -cvf project.tar project
In this FreeBSD example, the options are grouped together as -cvf. However, the tar(1) -f option must be followed by a filename, which is given as project.tar. At the end of the command line is a command-line argument project, which is the directory name to be archived. The command could also have been written this way:
$ tar -cv -fproject.tar project
In this example, the argument immediately follows the option name. Options that take an argument can have the argument value immediately follow the option letter or specified next on the command line as in a regular argument.
You might wonder how to know if what follows the option letter is an option argument or more options. This can't be determined by the appearance of the command line. This behavior is defined by the option itself, which is declared within the program.
3.144.77.71