Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a file as: filename.bz2 I need to decompress.

I have tried the command: tar xvjf filename.tar.bz2, but it didn't work as the file is not a tar file.

How do I 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.

up vote 203 down vote accepted

Try the following:

bzip2 -d filename.bz2

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

To preserve the original archive, add the -k option:

bzip2 -dk filename.bz2
share|improve this answer

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

share|improve this answer

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

share|improve this answer
1  
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 '15 at 17:22

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
3  
Excellent advice about the xjvf, just saved me. Thanks! – Edgar Aroutiounian Aug 17 '13 at 3:22
4  
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 '15 at 15:14
1  
tar xf should be sufficient with the BSD variant — the j flag is only used when compressing – Mark Fox Oct 30 '15 at 0:16
bzip2 -dc my_file.tar.bz2 | tar xvf -

worked for me on cygwin

share|improve this answer
1  
It would be helpful if you could add a few sentences to your answer to explain what it does. – fixer1234 May 21 '15 at 17:25
1  
@fixer1234 '-c' option copies the decompressed output to STDOUT which is then piped to tar utility and presented as filename using '-' so you can simplify it as: bzip2 -d my_file.tar.bz2 ; tar xvf my_file.tar – sactiw Jan 7 at 19:39
1  
I believe even this should work bzip2 -dc my_file.tar.bz2 | tar xv i.e. no need to use -f option and corresponding '-' sign after it because tar can directly read the from STDOUT through the pipe operator. Also, feel free to drop -v option if you don't want to list files being processed. – sactiw Jan 7 at 19:45
1  
This doesn't help, since the original poster already mentioned that it's not a tar archive. – icedwater Jan 15 at 2:29

Just give tar -xvf "file_name"

share|improve this answer
5  
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 '15 at 14:06
  1. Go to https://cloudconvert.com.
  2. Upload the file.
  3. Convert it into a .tar file.
  4. Download it.
  5. Extract it from there, in your terminal.
share|improve this answer
    
Isn't suitable for really large files! – narendranathjoshi Feb 3 at 9:04

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.