tar和zip有什么区别? [英] What is the difference between tar and zip?
问题描述
tar和zip有什么区别?每种情况都有哪些用例?
What is the difference between tar and zip? What are the use cases for each?
推荐答案
tar
本身将文件捆绑在一起(结果称为 tarball ),而 zip
也应用压缩。
tar
in itself just bundles files together (the result is called a tarball), while zip
applies compression as well.
通常,您使用 gzip
和 tar
来压缩生成的 tarball ,从而获得类似的结果就像 zip
一样。
Usually you use gzip
along with tar
to compress the resulting tarball, thus achieving similar results as with zip
.
对于相当大的档案,还是有重要的区别。 zip
存档是压缩文件的集合。压缩的tar是(未压缩文件的)压缩集合。因此,zip归档文件是可随机访问的级联压缩项的列表,而 .tar.gz
是必须可在访问目录之前进行完全扩展的归档文件。
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
的 caveat 是,您不会跨文件进行压缩(由于每个文件的压缩独立于存档中的其他文件,因此压缩无法利用不同文件内容之间的相似性); 优点是您可以通过仅查看归档文件的特定(取决于目标文件)部分来访问其中包含的任何文件(因为该收藏夹的目录与该收藏夹是分开的) -
.tar.gz
的 caveat 是您必须解压缩整个存档访问其中包含的文件(因为文件位于tarball中); 优点是压缩可以利用文件之间的相似性(压缩整个tarball)。
- The caveat of a
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). - The caveat of a
.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).
这篇关于tar和zip有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!