0

I see here that a tar is used to merge several files into one. So why do I see so often one zip file in a tar?

example : archive.zip.tar

  • 7
    That's not common at all in my experience, where did you see that? (.tar.gz and variations on the other hand is extremely common.) – Mat Nov 17 '15 at 11:13
  • 3
    because people do all sorts of strange things. and it's not illegal (or even immoral) to put a .zip inside a tar file. – cas Nov 17 '15 at 11:14
  • Maybe someone put a zip in a tar file to avoid a naive email attachment filter. – Joshua Taylor Nov 17 '15 at 14:23
  • why do you tar zip file? – mikeserv Nov 17 '15 at 14:43
6

Tar doesn't compress* - it's 'tape archive' and exists purely to serialise data - traditionally to a tape device.

It serialises a directory structure, including permissions and file contents.

gzip doesn't preserve structure, and just compresses on a 'file' bases - hence why you tend to get .tar.gz - it's a serialised structure that has then been compressed.

I don't know why you'd get .zip.tar though, given that zip does support directory structures, permissions and compression. It seems largely nonsensical to do so.

* newer versions of tar include the z flag to compress - this wasn't part of the original spec. So you'd tar cvf - ./path_to_tar | gzip -c > file.tar.gz

  • Doesn't it matter for the inode count? askubuntu.com/questions/436679/… – Thomas Nov 17 '15 at 11:31
  • 1
    You save the same number of inodes through tar and through zip; you save nothing if you use both at once. – SF. Nov 17 '15 at 11:41
  • Actually, just tar cv ./path_to_tar | gzip .., f - is unnecessary. – muru Nov 17 '15 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.