Connecting Tech Pros Worldwide Help | Site Map

need help to extract tar.bz2

Newbie
 
Join Date: Jun 2009
Location: Kathmandu, Nepal
Posts: 12
#1: Aug 29 '09
hi ,
I need a help to extract .tar.bz2 in ubuntu .
Regards,
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,128
#2: Aug 29 '09

re: need help to extract tar.bz2


what is the problem? in a console you might use:
Expand|Select|Wrap|Line Numbers
  1. tar xjvf your_file_name.tar.bz2
  2.  
but in ubuntu you should have the typical gnome-archive-manager as gui-tool for that? or do you use another window-manager?

kind regards
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,569
#3: Aug 29 '09

re: need help to extract tar.bz2


Quote:

Originally Posted by bob2044 View Post

hi ,
I need a help to extract .tar.bz2 in ubuntu .
Regards,

Unfortunately, the tar commands 'z' option only unzips .gz extentions. To unzip this, you will have to install bunzip2 if not already installed. You would then do the following:

Expand|Select|Wrap|Line Numbers
  1. bunzip2 file.tar.bz2
  2. tar -xvf file.tar
  3.  
If its not installed, simply do the following:

Expand|Select|Wrap|Line Numbers
  1. sudo apt-cache search bunzip
  2.  
Search the output for the name of the bunzip2 package and then do:

Expand|Select|Wrap|Line Numbers
  1. sudo apt-get install <package name>
  2.  
Regards,

Jeff
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,128
#4: Aug 29 '09

re: need help to extract tar.bz2


the tar man page refers to the j option i showed above to handle the .bz2 files ... or am i wrong? i often used the above shown command to extract such files ...?
micmast's Avatar
Familiar Sight
 
Join Date: Mar 2008
Location: Belgium
Posts: 136
#5: Aug 30 '09

re: need help to extract tar.bz2


To extract tar.bz2 you can use: tar -jxvf (v for viewing the content while extracting)
To extract .tar.gz you can use : tar -zxvf (again the v is for viewing the content)
works for me everytime
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,128
#6: Aug 30 '09

re: need help to extract tar.bz2


yep :) ... and a note: the dash is not really required anymore ... even when i often use it since i always used it too :)

kind regards
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,569
#7: Aug 30 '09

re: need help to extract tar.bz2


Well, I will have to play with the -j option. To tell you the truth, I hadn't explored the man page in a while. If that works, sweet! And thanks for the tip. :)

Regards,

Jeff
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,128
#8: Aug 31 '09

re: need help to extract tar.bz2


no problem ... it should work :)

kind regards
sumittyagi's Avatar
Expert
 
Join Date: Mar 2007
Location: New Delhi, India
Posts: 198
#9: Sep 10 '09

re: need help to extract tar.bz2


If i want to tar and zip a directory, then can I use the following command?

Expand|Select|Wrap|Line Numbers
  1. tar -zcvf <directory_name> tar_file_name
and also, will it tar and then zip the tar file, or it will zip all the files in the directory and then tar?
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,128
#10: Sep 15 '09

re: need help to extract tar.bz2


i think the filename should be before the folder to compress (at least i used it on my ubuntu machine that way and the man-page even shows that as example) and to the question - basicly i think it first creates the tar-archive and then uses zip to compress the archive. it is called solid compression ... or similar :) ... you might have a look here for a bit more info ...

kind regards
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,569
#11: Sep 15 '09

re: need help to extract tar.bz2


Quote:

Originally Posted by gits View Post

i think the filename should be before the folder to compress (at least i used it on my ubuntu machine that way and the man-page even shows that as example) and to the question - basicly i think it first creates the tar-archive and then uses zip to compress the archive. it is called solid compression ... or similar :) ... you might have a look here for a bit more info ...

kind regards

You are completely correct gits. The f option is to specify the file name to output to, thus, the name that immediately follows it should be the output file. After that, you can list everything you need to include in the file.
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,158
#12: Sep 18 '09

re: need help to extract tar.bz2


It will tar then zip.
Roughly: TAR is the "tape archive" format, meaning it lines up all the files sequencialy (no fragmenting) for when backups where done to a tape drive (Think like an ISO file for cds now). The gz and bz2 are compressions applied after the fact.
sumittyagi's Avatar
Expert
 
Join Date: Mar 2007
Location: New Delhi, India
Posts: 198
#13: Sep 20 '09

re: need help to extract tar.bz2


Thanks everybody for the useful information and a very nice duscussion!
Reply