Skip Navigation

[solved] Why is there no .gz.tar?

A .tar archive is basically only the files cat'ed together, with a header and index added, right?

And a .tar.gz takes forever to modify, because it needs to first extract the .tar.

So why is there no archive format that just cat'es the compressed files together?

9 comments
  • TAR is short for Tape ARchive. It was originally meant to be written to magnetic tapes. Like cassette tapes. As such they are not really meant to be changed much. You read the whole thing from beginning to end until you find what you're looking for.

    Modifying it would usually mean writing the whole thing again. So that is more a modern notion.

  • A .tar archive is basically only the files cat'ed together, with a header and index added, right?

    Tar does not include an index. It's just the headers and data cat'ed together. You have to read from the beginning of the archive until you find the file you want. This is exacerbated if the archive is also gzipped, since you have to decompress all the files leading up to the one you want, as opposed to skipping over them as you could do in an uncompressed tar archive.

    So why is there no archive format that just cat'es the compressed files together?

    That's essentially what a zip archive does. Each file is compressed separately and cat'ed together with uncompressed headers in between. Also zip archives do have an index which is what allows for random access and easy changes. The downside is that the compression ratio of a zip archive can be worse than a tar.gz archive.

  • Archiving (catting files together) and compression are two different actions. This is true even in formats and zip or rar where the functions have always been a part of the same utility. They are separated in Unix because the Tape ARchiver wasn't initially intended to produce a file on disk. The tar utility did eventually add compression but that's not always desirable.

    An archive of compressed files is just another archive regardless of the format.  Compressed files is also a bit vague a term.  Most video and music formats are compressed, so compressing them again doesn't really add much value and can sometimes even produce larger sizes.

  • I mean... you can do that manually. Apply gzip or xz or whatever to each file then just make a tarball of the compressed files. You could write a shell script to do that.

9 comments