The Computer Oracle

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

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Quirky Dreamscape Looping

--

Chapters
00:00 On Linux/Unix, Does .Tar.Gz Versus .Zip Matter?
00:48 Accepted Answer Score 81
02:34 Answer 2 Score 40
02:50 Answer 3 Score 36
03:20 Answer 4 Score 29
04:05 Answer 5 Score 11
04:28 Thank you

--

Full question
https://superuser.com/questions/146754/o...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #unix #zip

#avk47



ACCEPTED ANSWER

Score 81


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 (TAR: "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).

Note:
Apparently, modern versions of ZIP also store Unix-file-attributes (depends on your ZIP-software), so with modern-zip-software, the file-size will be the only difference.




ANSWER 2

Score 40


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




ANSWER 3

Score 36


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. If you need only 85%, zip will do fine.




ANSWER 4

Score 29


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. but the standard info-zip tool that comes with most linux-like os'es has no size limitations and preserves file permissions just fine.

see: https://en.wikipedia.org/wiki/Info-ZIP for capabilities




ANSWER 5

Score 11


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.