Command flags

A number of flags might follow the command name. Flags modify the operation of a command and are sometimes called options.

A flag is set off by spaces or tabs and usually starts with a dash (-). Exceptions are ps, tar, and ar, which do not require a dash in front of some of the flags. For example, in the following command:
ls -a -F

ls is the command name, and -a -F are the flags.

When a command uses flags, they come directly after the command name. Single-character flags in a command can be combined with one dash. For example, the previous command can also be written as follows:
ls -aF

There are some circumstances when a parameter actually begins with a dash (-). In this case, use the delimiter dash dash () before the parameter. The tells the command that whatever follows is not a flag but a parameter.

For example, if you want to create a directory named -tmp and you type the following command:
mkdir -tmp
The system displays an error message similar to the following:
mkdir: Not a recognized flag: t
Usage: mkdir [-p] [-m mode] Directory ...
The correct way of typing the command is as follows:
mkdir -- -tmp

Your new directory, -tmp, is now created.