8

From what I understand this type of file is an archive just like RAR files are. Why isn't there the .targz extension plain and simple? Is there more than one program that is creating this kind of file and each one is adding its extension to the resulting file ?

Is there any other equivalent to this type of file? It is the only "double extension" I saw until now. Is there any other kind of file like this ?

yoyo_fun
  • 1,883

4 Answers4

12

What is the reason that .tar.gz files have two extension instead of one? From what I understand this type of file is an archive just like RAR files are.

Not quite. Back in ye days of yore when CPU time was very expensive archives were often uncompressed or used the compression hardware on a tape drive. The tool usually use for this was tape archive.

Unlike what the name seems to suggest, it can write the archive to any file (and on Un*x a tape drive is just like a file). So creating a non-compressed archive is easy.

If you want to compress that then you can first create the archive (with all its files and folders) and then compress your archive.tar with something like compress. Compress adds a .Z suffix so you then have a file with two extensions. (archive.tar.Z).

In time compress was replaced with gzip (and the .gz extension) and many versions of tar can do this compression in place.

Rar (and arj, lha, zip and others) are way more modern and compress files in place. In which case you use one single program and you get one single extenstion. But for tar the extensions and the create whole archive and then compress the whole archive are a result of history.

fixer1234
  • 28,064
Hennes
  • 65,804
  • 7
  • 115
  • 169
3

Because it's a tar file compressed with gzip.

The making method is: tar a archive.tar dir/myfile

Then gzip archive.tar, which produces tar.gz by default.

In good old DOS days the extension was .tgz.

Ipor Sircer
  • 4,194
2

It is a holdover from older *Nix days. .TAR is a tape archive. 'Tarballing' created one file out of multiple files and/or folders, which made moving them to tape more efficient. It wasnt until later, that compressing those files became the standard. Hence the .tar.gz.

Keltari
  • 75,447
1

tar stands for tarball and archives (hence ball) (makes multiple files into one), and gz stands for gunzip and compresses (or zips) (reduces the size of) the file.


Another compressing method (alternative to Gunzip) is Bzip2 that uses different algorithm for compression. Meaning you could meet .tar.bz2 (or even its concatenated form .tbz) as well.