tar in itself just bundles files together (the result is called a tarball), while zip applies compression as well. Usually you use gzip along with tar to compress the resulting tarball, thus achieving similar results as with zip .
tar gz is better for Linux/Unix as it retains permissions, such as "executable" on scripts. OS X's Archive Utility and zip / unzip preserve permissions, but there might be other utilities that don't. Standard zip/unzip tools (info-zip) retain permissions on linux, and timestamps on windows.
The TAR file format is a very early archiving format that doesn't include any active compression by default. Often on Linux, items are tarred and then gzipped to compress them. TAR files typically end in . tar.
By breaking the file data up into small chunks and compressing them separately, it allows you to extract specific files or parts of files without having to decompress everything in the archive before it.
tar
in itself just bundles files together (the result is called a tarball), while zip
applies compression as well.
Usually you use gzip
along with tar
to compress the resulting tarball, thus achieving similar results as with zip
.
For reasonably large archives there are important differences though. A zip
archive is a collection of compressed files. A gzipped tar is a compressed collection (of uncompressed files). Thus a zip archive is a randomly accessible list of concatenated compressed items, and a .tar.gz
is an archive that must be fully expanded before the catalog is accessible.
zip
is that you don't get compression across files (because each file is compressed independent of the others in the archive, the compression cannot take advantage of similarities among the contents of different files); the advantage is that you can access any of the files contained within by looking at only a specific (target file dependent) section of the archive (as the "catalog" of the collection is separate from the collection itself)..tar.gz
is that you must decompress the whole archive to access files contained therein (as the files are within the tarball); the advantage is that the compression can take advantage of similarities among the files (as it compresses the whole tarball).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With