LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to extract a "tar.bz2" file? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-extract-a-tar-bz2-file-161371/)

deWin 03-23-2004 10:42 AM

how to extract a "tar.bz2" file?
 
What's the easiest way or command to extract a "tar.bz2" file to the current active folder?

Thanks for the help guys.

muah 03-23-2004 10:58 AM

'tar jxf filename.tar.bz2' should work

guygriffiths 03-23-2004 11:01 AM

Open a terminal and type:
tar xvjf filename.tar.bz2
Which will untar it to the current directory. Normally (99% of the time) it will create it's own subdirectory so you don't need to worry about that.
Just so you know:
tar - Tape ARchiver
And the options:
x - extract
v - verbose output (lists all files as they are extracted)
j - deal with bzipped file
f - read from a file, rather than a tape device

"tar --help" will give you more options and info

deWin 03-23-2004 11:02 AM

Cool thanks guys!

jong357 03-23-2004 12:03 PM

Well, double clicking on it is probably the 'easiest' way..... :) Often not the fastest way overall but easy, yes...

Delmarc 03-24-2004 11:02 AM

Hey thanks! I had the same question! :D :D :D

Devboy 04-19-2004 12:14 PM

double clicking on it is probably the 'easiest' way,

How would you do that in ssh?

deWin 05-15-2004 04:51 PM

I'm back with another question. How do I view these tar files?

ONEderer 05-15-2004 08:37 PM

bzip2 -d name-of-file, will unzip the file. Then you can use tar -xvf to open the tarball, then climb into the directory that the tarball created, and either run the program or compile the results.

hrepaja 05-12-2008 06:34 PM

Quote:

Originally Posted by guygriffiths (Post 834144)
Open a terminal and type:
tar xvjf filename.tar.bz2
Which will untar it to the current directory. Normally (99% of the time) it will create it's own subdirectory so you don't need to worry about that.
Just so you know:
tar - Tape ARchiver
And the options:
x - extract
v - verbose output (lists all files as they are extracted)
j - deal with bzipped file
f - read from a file, rather than a tape device

"tar --help" will give you more options and info

thanks a lot. this works to me.

imadoofus 05-12-2008 08:45 PM

Quote:

Originally Posted by deWin (Post 935138)
I'm back with another question. How do I view these tar files?

tar tvjf <file>

vinaymudgil007 11-04-2009 11:55 PM

another way of doing it
 
to extract in from .bz2 , use below
bzip2 -cd files.tar.bz2 | tar xvf -

and to compress into .bz2 , use below
bzip2 -cd files.tar.bz2 | tar tvf -


Thanks,
Vinay

damonh 08-08-2016 04:01 PM

Install bzip2
 
Just to add a comment: you'll need to install bzip2, ie. yum install bzip2 (RHEL, CentOS, Fedora).
Regards

chrism01 08-08-2016 11:55 PM

@damonh: have you seen the age of this thread?

sundialsvcs 08-09-2016 08:49 AM

FYI:

The doubled file-extension .tar.bz2, like .tar.gz, means that a so-called "tape-archive (tar)" file has been compressed, using either the "GZip" (gz) or the "BZip2" (bz2) compressor.

As you will see by reading the documentation (man tar), the tar command has options to build or to extract these compressed-archive files in a single convenient step. You could use two commands, to first decompress the archive then extract from it, but you don't have to.


All times are GMT -5. The time now is 01:17 PM.