Go to the first, previous, next, last section, table of contents.


Basic tar Operations and Options

tar can take a wide variety of arguments which specify and define the actions it will have on the particular set of files or the archive. The main types of arguments to tar fall into one of two classes: operations, and options.

Some arguments fall into a class called operations; exactly one of these is both allowed and required for any instance of using tar; you may not specify more than one. People sometimes speak of operating modes. You are in a particular operating mode when you have specified the operation which specifies it; there are eight operations in total, and thus there are eight operating modes.

The other arguments fall into the class known as options. You are not required to specify any options, and you are allowed to specify more than one at a time (depending on the way you are using tar at that time). Some options are used so frequently, and are so useful for helping you type commands more carefully that they are effectively "required". We will discuss them in this chapter.

You can write most of the tar operations and options in any of three forms: long (mnemonic) form, short form, and old style. Some of the operations and options have no short or "old" forms; however, the operations and options which we will cover in this tutorial have corresponding abbreviations. @FIXME{make sure this is still the case, at the end} We will indicate those abbreviations appropriately to get you used to seeing them. (Note that the "old style" option forms exist in GNU tar for compatibility with Unix tar. We present a full discussion of this way of writing options and operations appears in section Old Option Style, and we discuss the other two styles of writing options in section Mnemonic Option Style and section Short Option Style.)

In the examples and in the text of this tutorial, we usually use the long forms of operations and options; but the "short" forms produce the same result and can make typing long tar commands easier. For example, instead of typing

tar --create --verbose --file=afiles.tar apple angst aspic

you can type

tar -c -v -f afiles.tar apple angst aspic

or even

tar -cvf afiles.tar apple angst aspic

For more information on option syntax, see section Advanced GNU tar Operations. In discussions in the text, when we name an option by its long form, we also give the corresponding short option in parentheses.

The term, "option", can be confusing at times, since "operations" are often lumped in with the actual, optional "options" in certain general class statements. For example, we just talked about "short and long forms of options and operations". However, experienced tar users often refer to these by shorthand terms such as, "short and long options". This term assumes that the "operations" are included, also. Context will help you determine which definition of "options" to use.

Similarly, the term "command" can be confusing, as it is often used in two different ways. People sometimes refer to tar "commands". A tar command is the entire command line of user input which tells tar what to do -- including the operation, options, and any arguments (file names, pipes, other commands, etc). However, you will also sometimes hear the term "the tar command". When the word "command" is used specifically like this, a person is usually referring to the tar operation, not the whole line. Again, use context to figure out which of the meanings the speaker intends.


Go to the first, previous, next, last section, table of contents.