I've found tons of pages saying how to untar tar.bz2 files, but how would one untar a tar.bz file?
The most common uses of the tar command are to create and extract a tar archive. To extract an archive, use the tar -xf command followed by the archive name, and to create a new one use tar -czf followed by the archive name and the files and directories you want to add to the archive.
To extract (unzip) a tar. bz2 file simply right-click the file you want to extract and select “Extract”. Windows users will need a tool named 7zip to extract tar.
z – filter archive through gzip. r – append or update files or directories to the existing archive files. W – Verify an archive file. wildcards – Specify patterns in UNIX tar command.
use the -j
option of tar
.
tar -xjf /path/to/archive.tar.bz
According to the man pages for 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:
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.
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.
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 page as well as the archive of the bzip2 home page. The latter includes a link to the original bzip source, which is not compatible with bzip2 because the it would require patent encumbered code to de-compress files compressed with the original bzip.
The file types differ by magic number, bzip2 uses BZh, the original bzip uses BZ0.
If it's really an old bzip 1 archive, try:
bunzip archive.tar.bz
and you'll have a standard tar file.
Otherwise, it's the same as with .tar.bz2
files.
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