Quick Unpacking Instructions

Most tar files are compressed and end in either `.tar.gz' or `.tar.Z'. If that is the case, they can probably be unpacked into the current directory with
tar zxf filename
If tar complains about the z option, try
gzip -cd filename | tar xf -
If the file is not compressed (usually indicated by only ending in `.tar'), use only
tar xf filename

Explanation of tar and its Options

The archive format most people are familiar with is zip files, which are often created and extracted using the winzip utility, or the original pkzip programs. Zipping, in fact, does two jobs. It archives, which is gathering multiple files together into one file, but it also compresses the archive.

tar is only an archiver. (Historically, at least.)

The Option z

Since the most common compression program in UNIX these days is gzip, many tar files end in `.tar.gz', but it is also possible to get either `.tar.Z' (for the program compress), or just `.tar', which has not been compressed at all. `.Z' files are not of much concern since gzip can handle them too. As it became more popular for tar files to be compressed, people got tired of typing something like gzip -cd filename | tar xf - and so tar had the z option added to it which essentially says that the archive should be treated as compressed. This means uncompressing it before unpacking, and compressing it after archiving. Old versions of tar, however, do not have this option.

The Option x and Other Major Operations

tar is, in many ways, like winzip, and just like winzip it needs to be told what it is doing: unpacking an archive, adding to it, creating a new one, etc. It is not enough simply to run it. Unpacking is normally called extracting, and is indicated by the option x. Other common possibilities are c (for creating) and t (for testing). Testing an archive will go through the entire thing, and a file listing can be produced at the same time by adding v (for verbose). v can, in fact, be used with any of the other operations.

The Option f

It is with good reason that tar is called a tape archiver--this was the purpose for which it was programmed. Tar files were originally intended to be written to and read from tapes, and so most versions of tar will, by default, try to find a tape drive when they are run. The usual meaning of something like
tar x file
is not to extract an archive called file but to find file within the default archive, i.e. the tape drive. To specify an alternative `location' (file) for the archive, the f option is used followed by the name of the file.