LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-23-2004, 10:42 AM   #1
deWin
Member
 
Registered: Feb 2004
Distribution: Red Hat 9
Posts: 113

Rep: Reputation: 15
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.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-23-2004, 10:58 AM   #2
muah
Member
 
Registered: Aug 2003
Location: Europe
Distribution: Slackware (current)
Posts: 228

Rep: Reputation: 33
'tar jxf filename.tar.bz2' should work
 
3 members found this post helpful.
Old 03-23-2004, 11:01 AM   #3
guygriffiths
Member
 
Registered: Jun 2003
Location: Reading, UK
Distribution: Debian 3.0, LFS
Posts: 524

Rep: Reputation: 37
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
 
6 members found this post helpful.
Old 03-23-2004, 11:02 AM   #4
deWin
Member
 
Registered: Feb 2004
Distribution: Red Hat 9
Posts: 113

Original Poster
Rep: Reputation: 15
Cool thanks guys!
 
Old 03-23-2004, 12:03 PM   #5
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Well, double clicking on it is probably the 'easiest' way..... Often not the fastest way overall but easy, yes...
 
0 members found this post helpful.
Old 03-24-2004, 11:02 AM   #6
Delmarc
Member
 
Registered: Aug 2003
Location: Port Elizabeth, South Africa
Distribution: Mandrake 9.1, Windows XP Pro
Posts: 36

Rep: Reputation: 15
Hey thanks! I had the same question!
 
Old 04-19-2004, 12:14 PM   #7
Devboy
Member
 
Registered: Jul 2003
Location: IOM
Distribution: Slackware 10.
Posts: 194

Rep: Reputation: 30
double clicking on it is probably the 'easiest' way,

How would you do that in ssh?
 
Old 05-15-2004, 04:51 PM   #8
deWin
Member
 
Registered: Feb 2004
Distribution: Red Hat 9
Posts: 113

Original Poster
Rep: Reputation: 15
I'm back with another question. How do I view these tar files?
 
Old 05-15-2004, 08:37 PM   #9
ONEderer
Member
 
Registered: Jan 2004
Location: USA
Distribution: Mandrake, Knoppix
Posts: 51

Rep: Reputation: 15
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.
 
Old 05-12-2008, 06:34 PM   #10
hrepaja
LQ Newbie
 
Registered: Jun 2007
Posts: 1

Rep: Reputation: 1
Quote:
Originally Posted by guygriffiths View Post
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.
 
1 members found this post helpful.
Old 05-12-2008, 08:45 PM   #11
imadoofus
LQ Newbie
 
Registered: May 2008
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by deWin View Post
I'm back with another question. How do I view these tar files?
tar tvjf <file>
 
Old 11-04-2009, 11:55 PM   #12
vinaymudgil007
LQ Newbie
 
Registered: Sep 2004
Location: india
Distribution: pcqlinux
Posts: 10

Rep: Reputation: 1
Wink 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
 
1 members found this post helpful.
Old 08-08-2016, 04:01 PM   #13
damonh
LQ Newbie
 
Registered: Jan 2016
Location: Maldonado, Uruguay
Distribution: Manjaro
Posts: 6

Rep: Reputation: Disabled
Wink Install bzip2

Just to add a comment: you'll need to install bzip2, ie. yum install bzip2 (RHEL, CentOS, Fedora).
Regards
 
Old 08-08-2016, 11:55 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
@damonh: have you seen the age of this thread?
 
Old 08-09-2016, 08:49 AM   #15
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Undoing" a tar extract jrdioko Linux - Newbie 15 01-16-2012 05:51 PM
Unable to extract "tar.gz" file - please try for me Riddick Linux - Software 6 08-27-2005 04:57 PM
compiling tar.bz2... "./configure make make install" doesn't work dodo1983 Linux - Newbie 7 08-17-2004 12:34 AM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 08:54 AM
How to extract (unpack) file in "A" driver matin Linux - Newbie 1 03-01-2002 06:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration