In the GNU manual for tar
, there is the following example to show that the order of the options is important:
tar -cfv collection.tar blues folk jazz
In this case, because v
is placed after f
, then the tar archive will be named "v", and tar
will try to add collection.tar
to the archive if it exists in the current directory. But if I omit the -
from the beginning, then the command works as we would want it to, despite v
being placed after f
. Why?
Because that is the way the different option styles work and they behave differently.
The man page states for UNIX or short-option style, the one which is prefixed with a single dash.
The traditional style option style, the one without dashes:
As you can see, the UNIX or short-option style expects arguments to options directly after the option.
Whereas the traditional style option style expects a block of options and suitable arguments to the options in the right order.
It's clearly described in
man tar
:So in this case:
collection.tar
is an argument forf
andblues folk jazz
being the rest of arguments are treated as archive member names.