More information about Real Time's products & services is available on our sales web site. Direct links for each item are listed below:

Tar is an acronym for 'Tape ARchive', and is the most common tool for collecting a bunch of files into one easily-portable package. You will use this tool on a regular basis for moving files around. The three basic things you'll do with it are:


To create an archive, the syntax is usually something like this:

$ tar czvf tarball.tgz file1.txt file2.c dir1/

This means:

  • c -- create an archive
  • z -- gzip (compress) the archive
  • v -- verbose (shows what files are being taken)
  • f output-tarball.tgz -- the file that will be output, a Tarred and GZipped (.tgz) file.
  • file1.txt file2.c dir1/ -- two files and a directory that will be included in the created tarfile (or 'tarball' as it's often called).


To see what's in that gzipped tarball, run the following command:

$ tar tzvf tarball.tgz

The t means 'test' and it will do an integrity check on the tarfile. With the v option, it will verbosely show each file in the tarfile as it's tested.


Extracting all files from that tarball is as simple as:

$ tar xzvf tarball.tgz


Or, if you only want a specific file from the tarball, put the filename (including the relative path within the tarball) as an additional argument to the command.

$ tar xzvf tarball.tgz file1.txt


Keep in mind that Unix treats all devices as files. For this reason, you can tar to a device as easily as you can tar to a file. For instance, this command will tar up the contents of /home to the first SCSI tape drive:

# tar czvf /dev/st0 /home


Tar can also be used in a 'pass through' mode; whereby one uses tar to copy from one filesystem to another. This is useful in some cases, such as when you want to pass it over the network using ssh or netcat; or when you want to use the advanced include/exclude/preserve/dereference features of tar to treat the files in a particular way.

$ tar cpf - /dir/to/backup|tar xvp -C /place/you/want/to/put/that


Keep in mind that tar will remember the full path to the files; so the result of the above command will be /place/you/want/to/put/that/dir/to/backup

Watch out for corrupted tarballs!

One of the disadvantages of tar, is that if a compressed tar file becomes corrupt, all data sequentially after the corruption is lost! (Admittedly, this is not strictly a problem exclusive to tar. Compressing any file as a whole opens the possibility for this problem.) If the tar archive is uncompressed, it may be possible to recover at the next file within the archive; but this is not guaranteed (though they say it works pretty well).

The instructions and screen shots contained within this website are specific to services offered by Real Time Enterprises only.



Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Real Time Enterprises, Inc.

Real Time Enterprises, Inc.
10181 Crosstown Circle
Eden Prairie, MN 55344

Phone: (952) 943-8700
Fax: (952) 943-8500

Open Linux Menu
Open Macintosh Menu
Open Windows Menu
Open Source Menu
Website Search
Send Email