next up previous

3.1.4 Text Compression and File Archives     continued...

The most common archiving program in Unix is tar (tape archive). Originally this program was used to write directories on tape, but now it is used to collect all the files in a directory (including all subdirectories) into a single file. To use tar, type ``tar'' followed by a set of letters that tell it what to do (with no spaces between the letters) followed by the name of the archive file.

When you first retrieve an archive, it is a good idea to find out what files are in it before you extract them. For example, suppose the archive file is named foo.tar. The command

%  tar  tf foo.tar
will print the names of every file in the archive. When you extract the files, they will be inserted in the current working directory, exactly as you see them. If a file has a name of the form foo/bar, then tar will create a directory foo and put a file named bar in it.