2012-02-26 22 views

回答

49

使用tar-j選項。

tar -xjf /path/to/archive.tar.bz 
+3

我認爲最好將'-'關閉。只需'tar xjf/path/to/archive.tar.bz'就足夠了。 – 2015-05-15 14:37:20

3

如果它真的很老的bZIP 1歸檔,試試:

bunzip archive.tar.bz 

,你就會有一個標準的tar文件。 否則,它與.tar.bz2文件相同。

7

據在此基礎上對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. 

手冊頁,我猜「.BZ」被認爲是bzip2壓縮文件的有效後綴。另外,請記住,原始文件名可能是由手工生成的,是這樣的:

tar jcf archive.tar.bz /path/to/files 

不是這樣:

tar cf archive.tar /path/to/files && bzip2 archive.tar 

這將迫使文件名是archive.tar中。 BZ2。

除非你解壓縮的文件比1998年更早(1996年發佈bzip2),否則我猜測你實際上正在查看bz2文件。

如果您對bzip vs bzip2的歷史以及兩者之間的技術差異感興趣,可以在Wikipedia Bzip2 page以及bzip2 home page的歸檔中進行很好的討論。後者包含一個鏈接到原始的bzip源文件,它是而不是與bzip2兼容,因爲它需要專利保護代碼來解壓縮用原始bzip壓縮的文件。

文件類型因幻數不同而不同,bzip2使用BZh,原始bzip使用BZ0。