Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 23 down vote accepted

Most popular Linux distros these days are by default equipped with zip compatibility. But as stated by nc3b, tar and gzip are more common on Linux/Unix systems. If you need 95% compatibility on these systems, consider using tar and gzip. Of you only need 85%, zip will do fine.

share|improve this answer
Okay, 95% is better than 85% :-) A very minor question, does it matter at all if the file extension is .tgz instead of .tar.gz? – rwallace May 29 '10 at 19:34
Extension doesn't matter at all, it's just used for reference by users and programs. If the extension is .XXX and you know it's .tar, you could still use tar to untar it. .tgz and .tar.gz are both in fact the same extensions and files with these extensions would be similar. – BloodPhilia May 29 '10 at 19:43
On the other hand, for 100% compatibility on Windows you would need to use cab. – kinokijuf Nov 15 '11 at 17:39
tar will store uid, gid and permissions, such as +x on unix systems. zip stores archive, readonly, hidden and system on windows systems. – Andrew De Andrade Oct 30 '13 at 21:43
@BloodPhilia, So does that mean that we can GZip a file and rename it as .zip and it will correctly unzip? – Pacerier Apr 24 '14 at 11:33

tar gz is better for Linux/Unix as it retains permissions, such as "executable" on scripts.

share|improve this answer
OS X's Archive Utility and zip / unzip preserve permissions, but there might be other utilities that don't. – user495470 Jan 19 '13 at 15:33

tar/gzip is a pretty crappy format since the archive cannot be randomly accessed, updated, verified or even appended to... without having to decompress the entire archive.

zip is much better in that regard.... you can quickly obtain the contents of a zip file, append to it without recompressing the first part, etc.

zip has some size limitations ... depending on the version of "zip" that you use... and these can be a problem.

share|improve this answer
What kind of limitations are you talking about? – Pacerier Apr 24 '14 at 11:34
Tar and gzip can be appended to, even without knowing anything about the rest of the archive. In this regard, it is actually better then zip because zip files require modification to existing data during appending new data. Tar and zip are good at different things – Aaron Schif Dec 1 '15 at 22:08

Barebones Unix installs don't contain unzip (i.e. server installs), but they always contain tar and gzip. If your audience is servers, I'd go for gzip.

Also gzip has greater compression than zip, so the file will be smaller.

share|improve this answer
I wouldn't say gzip compresses better than ZIP. Both use the same DEFLATE algorithm, and all comparisons I've done give similar results in file size. – grawity May 29 '10 at 21:57
Well, tar.gz will compress the whole file in one go, whereas zip compresses files individually. For many small files, the first approach will usually generate noticeably smaller files, because redundancies can be used across files. The difference is not huge though. – sleske Jun 24 '10 at 16:09

tar and gzip are a lot more common on *nix-es than unzip. For instance, at the moment on my arch-2009.08 there is no unzip.

share|improve this answer
But there is bsdtar (part of libarchive), which handles ZIP fine. – grawity May 29 '10 at 19:19
Oops :"> Didn't know about that. Thanks! :-) – nc3b May 30 '10 at 7:22

Yes, it matters. Tar is an archiver. And in tar.gz, we compress that archive.

Zip is both an archiver and compressor.

If you compare compression, from my experience, gzip is much better than zip.

And the other significant difference is mentioned in another answer. If you have a very big file archive, and want to extract a small file, Zip allows you to do that. But with tar.gz, you need to extract entire archive.

share|improve this answer
Not an archive of gzipped files but a gzip of archived files. That's why you have to extract the whole archive. – m93a Feb 15 '15 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .