FAQ Answer

I am downloading a file through ftp that has ".tar," ".tar.gz," or ".tgz" in the filename. What does this mean and what do I do with it?

This is the Tape Archive (tar) file format that is commonly used to bundle multiple files and directories into a single downloadable file.  Tar files can also be compressed using "gzip," which results in a tag of either .tar.gz or .tgz.
   

To unzip a gzipped tar file, use the gnu utility "gunzip" or search on the Web for a third-party unzipping utility that works with your system (like Winzip™ or Stuffit™).  To use "gunzip," just include the filename and the result will be a tar file:

    % gunzip myfile.tar.gz
                --- > creates myfile.tar

To open the tar file, use the Unix "tar" command. First, you might want to look at the contents of the tar file. This example shows how to look at the contents of "myfile.tar":
        tar tvf myfile.tar

You will see a listing of files and possibly directory names, and it will indicate where the files in the tar file will be extracted. Note that this does not yet write any files to your disk, so it is safe and good practice to use.

You will want to verify that the files will extract to the place you want them. If the directory names in the tar file begin with a slash (/) instead of a dot (.) or directory name, it is advised that you think twice about extracting the files, especially if you are running as a privileged user. The reason for this is that the leading slash means the files will be extracted off of your system's root directory and could delete or replace vital system files. It is considered bad practice to have directory names with leading slashes in a tar file.

When you feel confident about where the files will be extracted, use the command:
        tar xvf myfile.tar
to extract the files. If you have any questions, send e-mail to comments@iris.edu.