Linux 如何在 unix 中解压 tar.bz 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9454929/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I untar a tar.bz file in unix?
提问by Tim
I've found tons of pages saying how to untar tar.bz2 files, but how would one untar a tar.bz file?
我发现很多页面都在说如何解压 tar.bz2 文件,但是如何解压 tar.bz 文件呢?
采纳答案by Shiplu Mokaddim
use the -j
option of tar
.
使用 的-j
选项tar
。
tar -xjf /path/to/archive.tar.bz
回答by Michele Spagnuolo
If it's really an old bzip 1 archive, try:
如果它确实是一个旧的 bzip 1 存档,请尝试:
bunzip archive.tar.bz
and you'll have a standard tar file.
Otherwise, it's the same as with .tar.bz2
files.
您将拥有一个标准的 tar 文件。否则,它与.tar.bz2
文件相同。
回答by Barton Chittenden
According to the man pages for bzip2
根据 bzip2 的手册页
If the file does not end in one of the recognised endings, .bz2, .bz, .tbz2 or .tbz, bzip2 complains that it cannot guess the
name of the original file, and uses the original name with .out appended.
Based on this, I'm guessing that '.bz' is considered a valid suffix for bzip2 compressed files. Also, keep in mind that the original file name was probably generated by hand, something like this:
基于此,我猜测 '.bz' 被认为是 bzip2 压缩文件的有效后缀。另外,请记住,原始文件名可能是手动生成的,如下所示:
tar jcf archive.tar.bz /path/to/files
Rather than doing this:
而不是这样做:
tar cf archive.tar /path/to/files && bzip2 archive.tar
Which would force the filename to be archive.tar.bz2.
这将强制文件名是 archive.tar.bz2。
Unless the file that you're unpacking is older than, say 1998 (bzip2 was released in 1996), I'm guessing that you're actually looking at a bz2 file.
除非您解压的文件早于 1998 年(bzip2 于 1996 年发布),否则我猜您实际上正在查看 bz2 文件。
If you're interested in the history of bzip vs bzip2 and the technical differences between the two, there's good discussion on the Wikipedia Bzip2 pageas well as the archive of the bzip2 home page. The latter includes a link to the original bzip source, which is notcompatible with bzip2 because the it would require patent encumbered code to de-compress files compressed with the original bzip.
如果您对 bzip 与 bzip2 的历史以及两者之间的技术差异感兴趣,可以在Wikipedia Bzip2 页面以及bzip2 主页的存档中进行很好的讨论。后者包含指向原始 bzip 源代码的链接,该链接与 bzip2不兼容,因为它需要受专利保护的代码来解压缩使用原始 bzip 压缩的文件。
The file types differ by magic number, bzip2 uses BZh, the original bzip uses BZ0.
文件类型因幻数而异,bzip2 使用 BZh,原始 bzip 使用 BZ0。