tar和zip的区别是什么?每个用例是什么?
当前回答
Tar本身只是将文件捆绑在一起(结果称为tarball),而zip也应用压缩。
通常使用gzip和tar来压缩生成的tarball,从而获得与使用zip类似的结果。
然而,对于相当大的档案,有重要的区别。压缩档案是压缩文件的集合。gzip的tar是一个压缩的集合(未压缩的文件)。因此,zip归档是一个随机可访问的连接压缩项列表,而.tar.gz是一个必须在目录可访问之前完全展开的归档。
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本身只是将文件捆绑在一起(结果称为tarball),而zip也应用压缩。
通常使用gzip和tar来压缩生成的tarball,从而获得与使用zip类似的结果。
然而,对于相当大的档案,有重要的区别。压缩档案是压缩文件的集合。gzip的tar是一个压缩的集合(未压缩的文件)。因此,zip归档是一个随机可访问的连接压缩项列表,而.tar.gz是一个必须在目录可访问之前完全展开的归档。
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).
推荐文章
- 如何生成一个核心转储在Linux上的分段错误?
- 在Python中如何在Linux和Windows中使用“/”(目录分隔符)?
- 使用sh shell比较字符串
- 只列出UNIX中的目录
- 如何限制从grep返回的结果的数量?
- 如何管道列表的文件返回的找到命令到猫查看所有文件
- 以相对于当前目录的路径递归地在Linux CLI中列出文件
- 如何使用xargs复制名称中有空格和引号的文件?
- 在makefile中抑制命令调用的回声?
- Shell脚本for循环语法
- 是否有一个类似拉链的功能,垫到最长的长度?
- read()和recv(), send()和write()之间有什么区别?
- 如何将多行输出连接到一行?
- 在Unix中删除回车
- 如何在vi文本编辑器中获得文件的sudo访问权限?