LinuxQuestions.org
Visit Jeremy's Blog.
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 01-26-2009, 09:29 PM   #1
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Rep: Reputation: 15
Question How to extract tar.bz2 file?


I downloaded Maven from http://mirror.atlanticmetro.net/apac....9-bin.tar.bz2 and when I tried to unpack it I used the command "tar xvjf apache-maven-2.0.9-bin.tar.bz2" but got an error message says :
tar: bzip2: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors


What would be the right command to extract that file?
Any help will be very much appreciated.
 
Old 01-26-2009, 09:41 PM   #2
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
make sure you are in ther same directory as the tar file and use bzip2 then it will extrat to a tar file then use tar command. but the only reason you have that error is you are not in that directory or you missed typed. man bzip2
man tar.
Quote:
bunzip2 -d apache-maven-2.0.9-bin.tar.bz2
then go back and untar tar "
Quote:
tar -xfv apache-maven-2.0.9-bin.tar.bz2
but if you are using a xwindows then use your archiver in kde and roxroller i think it is in gnome.

Last edited by Drakeo; 01-26-2009 at 09:50 PM.
 
Old 01-26-2009, 09:48 PM   #3
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Drakeo View Post
make sure you are in ther same directory as the tar file and use bzip2 then it will extrat to a tar file then use tar command. but the only reason you have that error is you are not in that directory or you missed typed. man bzip2
man tar.
then go back and untar tar "
I'm sorry I'm very new to this.
How can I know if I'm in the same directory as the tar file?
 
Old 01-26-2009, 10:53 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by yuri16 View Post
I'm sorry I'm very new to this.
How can I know if I'm in the same directory as the tar file?
Usually the prompt will tell you where you are. Though admittedly it can vary from distro to distro and from shell to shell, so sometimes it's not so clear. You can then use the pwd command, it will always tell you where you are:

Code:
$ pwd
/home/i92gubo
You can use cd to change from one directory to another. The other part of the problem is knowing where did you download the file. Desktops usually hide details from you which I think is a bad thing (and the reason becomes obvious in this very same thread).

If you don't know where did you download the file you will need to check and find that. Try to look in your desktop or your file explorer or whatever, and see if you can find the path to the file somewhere on its properties, the navigation bar or whatever.

You can as well use the find command. For example, in your terminal you could do this (lines beginning with '#' are comments):

Code:
# The next line changes to your home dir, You are probably
# there, but just in case
cd ~
# this line tells find to search for a file called myfile.txt
# starting from the current dir (.) and going thru all the subdirs
find . -name myfile.txt
If find can find it then it should spit the patch to the file. You can then use cd to go into that dir, and ls to list the files.
 
Old 01-27-2009, 12:06 AM   #5
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
When I type teh ff:

Code:
find . apache-maven-2.0.9-bin.tar.bz2
Here's teh output:

Code:
.
./.viminfo
./.bash_history
./.profile
./.bashrc
find: apache-maven-2.0.9-bin.tar.bz2: No such file or directory
But when I type ls from the root, I found the "apache-maven-2.0.9-bin.tar.bz2", but for some reason I can not extract it.

Here's the list of files from the root:

Code:
gridport:/# ls
apache-maven-2.0.9-bin.tar.bz2 etc media     root usr
bin    home mirror.atlanticmetro.net  sbin var
boot    initrd mnt     srv
dev    lib opt     sys
emul    lib64 proc     tmp
 
Old 01-27-2009, 12:12 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by yuri16 View Post
When I type teh ff:

Code:
find . apache-maven-2.0.9-bin.tar.bz2
Here's teh output:

Code:
.
./.viminfo
./.bash_history
./.profile
./.bashrc
find: apache-maven-2.0.9-bin.tar.bz2: No such file or directory
You forgot the -name. However, your ls shows that the file is on the current directory. So just using "tar xf apache-maven-2.0.9-bin.tar.bz2" will extract it. If that doesn't work, try xjf instead of xf. If that doesn't work, use "tar -xvjf apache-maven-2.0.9-bin.tar.bz2" to add some versobity, and paste the output here.

Quote:
But when I type ls from the root, I found the "apache-maven-2.0.9-bin.tar.bz2", but for some reason I can not extract it.
Paste the output, errors, or whatever as said above. Otherwise we can only guess.

Last edited by i92guboj; 01-27-2009 at 12:15 AM.
 
Old 01-27-2009, 12:31 AM   #7
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
When I tried it with -name, here's the output:

Code:
gridport:/# find. -name apache-maven-2.0.9-bin.tar.bz2
-bash: find.: command not found
And here are the outputs on your suggested commands:

Code:
gridport:/# tar xf apache-maven-2.0.9-bin.tar.bz2
tar: bzip2: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
Code:
gridport:/# tar xjf apache-maven-2.0.9-bin.tar.bz2
tar: bzip2: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
Code:
gridport:/# tar -xvjf apache-maven-2.0.9-bin.tar.bz2
tar: bzip2: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
What seems to be the problem?
Thanks for helping me, I really appreciate it.
 
Old 01-27-2009, 12:55 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by yuri16 View Post
When I tried it with -name, here's the output:

Code:
gridport:/# find. -name apache-maven-2.0.9-bin.tar.bz2
-bash: find.: command not found
You need to be very careful when typing, and even more if operating as root. It's the best advice I can give you.

Note that the same error is telling you what's happening. It can't find a command named "find.", because it doesn't exist. The command is "find", without a dot. The dot must be separated by a space because otherwise linux thinks it's part of the command name.

Code:
find . -name apache-maven-2.0.9-bin.tar.bz2
Try it and it should work.

Code:
gridport:/# tar xf apache-maven-2.0.9-bin.tar.bz2
tar: bzip2: Cannot exec: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
This can mean a number of things, but usually it means that bzip2 is not installed. Strange because it's a standard tool. Can you check your package manager and see if the bzip2 package is installed? I think the problem might lie there. If you don't know how to deal with your package manager (or you don't know what that is at all) let me know your distro and I or someone around will be able to tell you how to check if bzip2 is installed and how to install it.

For example, in debian or ubuntu it should be this if my memory is on today:

Code:
apt-get install bzip2
 
Old 01-27-2009, 01:15 AM   #9
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
I'm sorry about that, it was really my first time so I'm depending on you.
Anyway, I installed the bzip as like what you said. And it works.

I tried again the:

Code:
tar xf apache-maven-2.0.9-bin.tar.bz2
And it seems it works now. My question probably the last (I hope), how would I know if the command above worked? What command should I use? And if I unpacked the apache maven means it was already installed? Please bear with me..thank you.
 
Old 01-27-2009, 01:31 AM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by yuri16 View Post
And it seems it works now. My question probably the last (I hope), how would I know if the command above worked?
If no error was shown, then it worked. If you now use ls you should see the contents of the tarball. It will probably be on a directory with a name that's similar to this of the tarball, but without tar.bz2 of course.

A note for future usage is that you can use xvf to get a more verbose output. That why tar will output all the files it's extracting, so you will see them as they are decompressed. That will make it easier to find them later.

If you can't find the extracted files or identify them, you can as well use "tar tvf filename.tar.bz2" to list the contents of the tarball without extracting it again, so you can see where the files went.

Quote:
And if I unpacked the apache maven means it was already installed? Please bear with me..thank you.
By no means. This is an apache extension, so you will probably need to put it somewhere on the apache directory tree and probably configure it or apache or both so they can work together.

I can't help with that part because I don't use apache, but lighttpd as my web server of choice.

However, inside the directory where the package has been decompressed you should be able to find some readme or install file explaining you how to proceed. That's true most times. Another place where you can find docs about a given program or extension is usually the web site from where you downloaded it.

I am glad to be of any help.
 
Old 01-27-2009, 01:31 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
If your ran command and tar did not give you any errors while exiting, then probably you extracted it. Also it would create a directory without .tar.bz2 extension.
You will need to install the package that you downloaded. You just unpacked it like you unrar or unzip in windows.
It looks from the name that it is a binary file and you will need to look into the permissions and run the file. For changing the permissions you will need chmod command. To change permissions to allow you to execute the file do
chmod +x apache-mavenxxx.bin
Then execute the file.
But it may not be a binary file and you may have to look into it if it is a directory. If it is, then there should be a script called configure. You will need to run this script to move ahead. If everything goes fine with this script then run make and sudo make install.
 
Old 01-27-2009, 02:13 AM   #12
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by i92guboj View Post
If no error was shown, then it worked. If you now use ls you should see the contents of the tarball. It will probably be on a directory with a name that's similar to this of the tarball, but without tar.bz2 of course.

I am glad to be of any help.
I already see the tarball without tar.bz2. Thank you so much for the help.
I hope the next time I need help, I can count on you again.
 
Old 01-27-2009, 02:15 AM   #13
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by linuxlover.chaitanya View Post
If your ran command and tar did not give you any errors while exiting, then probably you extracted it. Also it would create a directory without .tar.bz2 extension.
You will need to install the package that you downloaded. You just unpacked it like you unrar or unzip in windows.
It looks from the name that it is a binary file and you will need to look into the permissions and run the file. For changing the permissions you will need chmod command. To change permissions to allow you to execute the file do
chmod +x apache-mavenxxx.bin
Then execute the file.
But it may not be a binary file and you may have to look into it if it is a directory. If it is, then there should be a script called configure. You will need to run this script to move ahead. If everything goes fine with this script then run make and sudo make install.
Hi,
can you tell me exactly what command should I use to run the apache-maven-2.0.9?
Seems the
chmod +x apache-mavenxxx.bin
command could not access.

Thanks.
 
Old 01-27-2009, 02:42 AM   #14
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
If you can see the file there without .tar.bz2 extension then change the permissions on that file or directory. Alternatively post the output of ls -l where the extracted package is saved so that someone here can point you in correct direction.
 
Old 01-27-2009, 02:49 AM   #15
yuri16
Member
 
Registered: Jan 2009
Location: Philippines
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by linuxlover.chaitanya View Post
If you can see the file there without .tar.bz2 extension then change the permissions on that file or directory. Alternatively post the output of ls -l where the extracted package is saved so that someone here can point you in correct direction.
Oh, why is that the output was "total 0" when I tried the ls -l??
 
  


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
how to extract a "tar.bz2" file? deWin Linux - Newbie 14 08-09-2016 08:49 AM
How to extract and install from .tar.gz and .tar.bz2 wstay Linux - Newbie 4 11-08-2008 10:14 AM
extract 1 file out of a .tar.bz2 oldsko0l Linux - Software 7 10-15-2006 06:14 PM
tar.bz2 Fails To Extract carlosinfl Linux - General 6 10-16-2005 12:33 PM
extract .tar.bz2 EcceVery Debian 3 11-24-2004 12:39 PM

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

All times are GMT -5. The time now is 03:21 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