.tar.gz file format FAQ

I get too much email asking me how to deal with .tar.gz files, so I've compiled this short FAQ.

What is .tar.gz format?

Under Unix, tar archives are the most common means of distributing bundles of files, and gzip is the most common compression program.

A .tar.gz file is simply a bundle of files packaged with tar, and subsequently compressed with gzip.

Sometimes the extension ".tgz" is used as an abbreviation for ".tar.gz". This is especially common on platforms such as MS-DOS that have arbitrary constraints on filenames (no more than one dot, and no more than three characters after the dot).

Why are the programs supplied in this format?

I do all of my software development under Linux, which is a Unix clone.

How can I extract these files?

Typically the decompression would be done using gunzip, part of the Free Software Foundation's GNU gzip package. Precompiled binaries for many platforms including Windows and Macintosh are available from The gzip home page. For detailed information on using gzip, please refer to the online documentation.

The file extraction from the decompressed archive would be done using tar. Most unix-like operating systems come with an implementation of tar. The Free Software Foundation has a very good implementation called GNU tar. For detailed information on using GNU tar, please refer to the online documentation.

A nice feature of GNU tar is the ability to specify compression and decompression on the command line using the "-z" option, which causes GNU tar to automatically invoke GNU zip. Thus to extract files from foo.tar.gz, you would simply say "tar -xzf foo.tar.gz".

If you use a version of tar that does not have the "-z" option, you'll need to invoke it as "gunzip -c foo.tar.gz | tar -xf -", where the "-c" tells gunzip to write to standard output, the vertical bar tells the shell to pipe the output of gunzip into tar, and the "-" tells tar to read its input from the pipe.

Some operating systems may not support pipes, in which case you would have to do this in two steps. First decompress the file: "gunzip foo.tar.gz". This should leave the decompressed file as foo.tar. Then extract it using "tar -xf foo.tar".

There are versions of GNU gzip and GNU tar available for most platforms. Linux and most BSD Unix variants typically come with GNU gzip and GNU tar. For other operating systems you may be able to find precompiled binaries, or download the source code and build it yourself.

I don't like command lines. Isn't there a user-friendly tool?

Yes, there are many of them. On Linux and Unix systems, you could use File Roller (part of the GNOME environment) or Ark (part of the KDE environment).

How can I extract these files under Windows or DOS?

I recommend 7-Zip, an open source program. It is better than many of the commercial archiving programs.

Windows command line and MS-DOS ports of GNU gzip and GNU tar are available from the unixutils project.

How can I extract these files on a Macintosh?

For MacOS X, gzip and tar are readily available.

Can these files be provided in another format?

The simple answer is "no".

I used to provide files in ".zip" format as well, but I found that people would download both the .tar.gz and the .zip files, even though my web page pointed out that the actual content was identical and requested that people not download both. Since that's a waste of my internet bandwidth, I've decided to provide the files in only a single format, and the easiest for me to provide is .tar.gz.

I don't believe that it is particularly burdensome to expect people who want to use my software to obtain the appropriate utilities. It took me a lot of time to write these programs, and I have no interest in spending my own time helping people that can't be bothered to spend just a few minutes finding the utilities. If you think it's worth your effort to download my software, then it should also be worth your effort to equip your computer to extract it.

Several people have told me that they are offended by my attitude. That's fine, since I'm offended by theirs. They are quite welcome to find the programs they want somewhere else. I'm not forcing anyone to use my software packages or my web site.

home Back to my home page

Last updated November 15, 2007

Copyright 1999, 2000, 2007 Eric Smith


Valid HTML 4.01 Transitional! check now