Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file as: filename.bz2, but I can't figure out how to decompress it. I tried several methods, none of them seems work.

I have tried the command: tar xvjf filename.tar.bz2, but it didn't work as the file is not a tar file. Would anyone know how to decompress this file?

share|improve this question

migrated from stackoverflow.com Sep 28 '12 at 19:42

This question came from our site for professional and enthusiast programmers.

6 Answers 6

up vote 150 down vote accepted

Try the following:

bzip2 -d filename.bz2

Note, that this command will not preserve original archive file.

share|improve this answer
37  
bzip2 -dk filename.bz2 keep original file. –  Trindaz Sep 18 '14 at 18:28

Just give tar -xvf "file_name"

share|improve this answer
2  
Welcome to SuperUser! Thanks for posting an answer. However, the original asker indicated one problem is that the file is not a tar, and thus tar chokes on it. –  Brian Jun 30 at 14:06
bzip2 -dc my_file.tar.bz2 | tar xvf -

worked for me on cygwin

share|improve this answer
    
It would be helpful if you could add a few sentences to your answer to explain what it does. –  fixer1234 May 21 at 17:25

Use the bunzip2 (or bzip2 -d) command to decompress the file. For more information see this man page,

share|improve this answer

Just to explain a bit further, a single file can be compressed with bzip2 thus:

bzip2 myfile.txt

tar is only required when compressing multiple files:

tar cvjf myfile.tar.bz *.txt

Hence, when uncompressing a .bz2 file use bunzip, when uncpresssing a tar.bz2 file use tar xjvf.

share|improve this answer
2  
Excellent advice about the xjvf, just saved me. Thanks! –  Edgar Aroutiounian Aug 17 '13 at 3:22
2  
You can just use tar xjf filename.tar.bz2. The v just adds verbose output. Keep your terminal clean! I also had problems running tar -xjf, so be sure to try running it sans the - –  MrOodles Jan 15 at 15:14

Use bunzip2: http://www.manpagez.com/man/1/bunzip2/

share|improve this answer
    
This isn't really a solution. It's just a hint and a link so someone can figure out their own solution. Since other answer provide actual solutions, this post adds no value. –  fixer1234 May 21 at 17:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.