Professional Documents
Culture Documents
Command line is probably the most universal way of passing information from
caller to the program. Concept of a command line is part of most operating
systems and programming languages including C and C++. However model
and terminology for command line processing vary greatly among different
systems.
The idea behind this document is to establish terminology and complete model
for command line processing. Terms translation between this document, Single
UNIX Specification and GNU Standard for Command Line Interfaces is provided
in Appendix A.
tar x
Here we have a one letter command 'x' (extract). In GNU tar manual it is
called functional letter.
tar xvf
openssl req
tar --help
Option consists of option name and optionally one or more option values.
Options are usually optional. Non-optional options are usually better
represented by commands or operands.
Option name usually takes up one argument. Option names usually start with a
prefix (e.g. '--compile-only', '-c' or '/c' ). This helps distinguish them from
commands and operands. Option name may have aliases (e.g. for option name
'--output-dir' there could be an '-o' alias).
Option without a value is alway optional and represents an option with implied
binary value (e.g. {0, 1} or {false, true} etc.). Such option is sometimes called
flag.
Here we have an option with name '-o' which has a value 'hello.o'.
'hello.cpp' is an operand.
ls -l
foo --bar=a,b,c
foo -b "a,b,c"
foo /baz a b c
Here we have a program option with name '-z' and value '6' (set
compression level to be 6). 'checkout' is a command. -P is a command flag
(prune empty directories). 'foo' is a command operand.
Same as with option the concept of operand can be further refined to program
operand and command operand.