short create (GNU tar 1.35)

#### 2.6.4 Short Forms with ‘`create`’

As we said before, the `--create` (`-c`) operation is one of the most basic uses of `tar`, and you will use it countless times. Eventually, you will probably want to use abbreviated (or “short”) forms of options. A full discussion of the three different forms that options can take appears in The Three Option Styles; for now, here is what the previous example (including the `--verbose` (`-v`) option) looks like using short option forms:

    $ tar -cvf collection.tar blues folk jazz
    blues
    folk
    jazz

As you can see, the system responds the same no matter whether you use long or short option forms.

One difference between using short and long option forms is that, although the exact placement of arguments following options is no more specific when using short forms, it is easier to become confused and make a mistake when using short forms. For example, suppose you attempted the above example in the following way:

    $ tar -cfv collection.tar blues folk jazz

In this case, `tar` will make an archive file called `v`, containing the files `blues`, `folk`, and `jazz`, because the ‘`v`’ is the closest “file name” to the `-f` option, and is thus taken to be the chosen archive file name. `tar` will try to add a file called `collection.tar` to the `v` archive file; if the file `collection.tar` did not already exist, `tar` will report an error indicating that this file does not exist. If the file `collection.tar` does already exist (e.g., from a previous command you may have run), then `tar` will add this file to the archive. Because the `-v` option did not get registered, `tar` will not run under ‘`verbose`’ mode, and will not report its progress.

The end result is that you may be quite confused about what happened, and possibly overwrite a file. To illustrate this further, we will show you how an example we showed previously would look using short forms.

This example,

    $ tar --create folk blues --file=collection.tar jazz

is confusing as it is. It becomes even more so when using short forms:

    $ tar -c folk blues -f collection.tar jazz

It would be very easy to put the wrong string of characters immediately following the `-f`, but doing that could sacrifice valuable data.

For this reason, we recommend that you pay very careful attention to the order of options and placement of file and archive names, especially when using short option forms. Not having the option name written out mnemonically can affect how well you remember which option does what, and therefore where different names have to be placed.