Linux – On Linux/Unix, does .tar.gz versus .zip matter

linuxunixzip

Cross-platform programs are sometimes distributed as .tar.gz for the Unix version and .zip for the Windows version. This makes sense when the contents of each must be different.

If, however, the contents are going to be the same, it would be simpler to just have one download. Windows prefers .zip because that's the format it can handle out of the box. Does it matter on Unix? That is, I tried today unzipping a file on Ubuntu Linux, and it worked fine; is there any problem with this on any current Unix-like operating system, or is it okay to just provide a .zip file across the board?

Best Answer

Yes, it matters.
Actually, it depends.

tar.gz

  • Stores unix file attributes: uid, gid, permissions (most notably executable). The default may depend on your distribution, and can be toggled with options.
  • Consolidates all files to be archived in one file ("Tape ARchive").
  • Actual compression is done by GZIP, on the one .tar file

zip

  • Stores MSDOS attributes. (Archive, Readonly, Hidden, System)
  • Compresses each file individually, then consolidates the individually compressed files in one file
  • Includes a file table at the end of the file

Because zip compresses the files individually, a zip-archive will most-likely have a larger size (especially with many smaller files - think config files).

So you see, appart from file size, if you zip a bunch of files on Linux/Unix, and then unzip them, the file-attributes will be gone (at the very least those not supported by MS-DOS - depends on what ZIP-software you use). This may matter, or it may not, in which case it doesn't matter (because the file-size difference is in most cases negligible).

Related Question