LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-14-2003, 02:35 PM   #1
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Rep: Reputation: 15
Choosing where to extract tar.gz


How can i direct where my files gets extracted from tar.gz files?

I know that

'tar -xzvf [filename]' extracts the tar.gz files in the current directory where the tar.gz files are located.

But say i wanted the file to be extracted into 'usr/local' dirctory. How can i modify that command to make this possible?

So this is the simple diagram:

('tar.gz' file is in 'Desktop' directory) > (Command line) > (All the files in that 'tar.gz' gets extracted into 'usr/local' directory)

Any idea on how i can do this?

Thank You.

Last edited by Arclite; 08-14-2003 at 02:38 PM.
 
Old 08-14-2003, 02:40 PM   #2
ichbinesderelch
Member
 
Registered: Nov 2002
Location: Austria
Distribution: Redhat 9
Posts: 140

Rep: Reputation: 15
i would change to the directory /usr/local/ and simply extract the files there
 
Old 08-14-2003, 02:46 PM   #3
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by ichbinesderelch
i would change to the directory /usr/local/ and simply extract the files there
Problem is that i can't move anything in there unless i'm a root. In order to do this i need to use command to extract tar.gz file in there.
 
Old 08-14-2003, 03:00 PM   #4
ichbinesderelch
Member
 
Registered: Nov 2002
Location: Austria
Distribution: Redhat 9
Posts: 140

Rep: Reputation: 15
but if you wanna put the extracted files there you need to get root anyway, so it wouldn't be a problem
 
Old 08-14-2003, 03:04 PM   #5
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by ichbinesderelch
but if you wanna put the extracted files there you need to get root anyway, so it wouldn't be a problem
Do u mean actually logging in as root?

I was thinking along the lines of:

'su' and become a root in the command line. Then i can just type whatever command to extract 'tar.gz' into that 'usr/local' directory.

I need the command that adds to 'tar -xzvf [filename]' so i can do this process.
 
Old 08-14-2003, 03:07 PM   #6
ichbinesderelch
Member
 
Registered: Nov 2002
Location: Austria
Distribution: Redhat 9
Posts: 140

Rep: Reputation: 15
hhm, i didn't get your questions, but i would simply typ "su", root password, go to /usr/local/ and tar -xvzf [filename], so the files are in /usr/local/..?
 
Old 08-14-2003, 03:21 PM   #7
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by ichbinesderelch
hhm, i didn't get your questions, but i would simply typ "su", root password, go to /usr/local/ and tar -xvzf [filename], so the files are in /usr/local/..?
The Actual 'tar.gz' is on my Desktop, not in the usr/local.

I can't copy 'tar.gz' files into usr/local in the first place cause i'm not a root in GUI.

Thanks for your replys BTW .
 
Old 08-14-2003, 03:28 PM   #8
ichbinesderelch
Member
 
Registered: Nov 2002
Location: Austria
Distribution: Redhat 9
Posts: 140

Rep: Reputation: 15
ah, well, so you know the adress path of the desktop? i never save files on desktop so i don't really now it, but lets say the path of the desktop is //desktop:// or something, than change to /usr/local, and than tar -xvzf //desktop://xxx.tar.gz, you needn't to be in the directory where the tar.gz file is to untar it
no problem..
 
Old 08-14-2003, 03:33 PM   #9
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by ichbinesderelch
ah, well, so you know the adress path of the desktop? i never save files on desktop so i don't really now it, but lets say the path of the desktop is //desktop:// or something, than change to /usr/local, and than tar -xvzf //desktop://xxx.tar.gz, you needn't to be in the directory where the tar.gz file is to untar it
no problem..
I think this is it! Thx alot! I'm going to go try it .

Your a lifesaver.
 
Old 08-14-2003, 03:37 PM   #10
ichbinesderelch
Member
 
Registered: Nov 2002
Location: Austria
Distribution: Redhat 9
Posts: 140

Rep: Reputation: 15
well, hopefully i helped you
good luck
 
Old 08-14-2003, 03:38 PM   #11
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Original Poster
Rep: Reputation: 15
tar -xvzf //Desktop://MozillaFirebird-0.6.1-i686-pc-linux-gnu.tar.gz

hmmm? does that look right? I typed that in root mode was used it while i was in /usr/local

I get this error:

'
tar (child): Cannot execute remote shell: No such file or directory
tar (child): //Desktop\://MozillaFirebird-0.6.1-i686-pc-linux-gnu.tar.gz: Cannot open: Input/output error
tar (child): Error is not recoverable: exiting now

gzip: stdin: unexpected end of file
tar: Child returned status 2
tar: Error exit delayed from previous errors
'

Last edited by Arclite; 08-14-2003 at 03:42 PM.
 
Old 08-14-2003, 03:45 PM   #12
ichbinesderelch
Member
 
Registered: Nov 2002
Location: Austria
Distribution: Redhat 9
Posts: 140

Rep: Reputation: 15
are you using gnome or kde
in case of gnome it would be ~/.gnome-desktop/xx.tar.gz, so all files on desktop would be in .gnome-desktop in your home directory,
if you are using kde maybe .kde-desktop, look with 'ls -a' in your home directory for it
 
Old 08-14-2003, 03:46 PM   #13
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
In your HOME directory, there should be a directory called Desktop. Your file is in that directory.

To extract a TAR GZip (.tar.gz) file to another location, type:
Code:
tar -zxvf <myFile.tar.gz> -C /usr/local
 
Old 08-14-2003, 03:52 PM   #14
Arclite
Member
 
Registered: Aug 2003
Posts: 56

Original Poster
Rep: Reputation: 15
I got it! Desktop was like u said Mat,

It was beneath other director such as home.

This code did it:

tar -xvzf //home//linux//Desktop//MozillaFire.tar.gz

Just to correct your previous post, there is no ':' after desktop or any other directory name

Thanks ichbinesderelch for all your help!


MathieuI i'm going go give that a try too just for learning. Altho i wish i knew what that '-C' means. Thanks for your help too!
 
Old 08-14-2003, 03:57 PM   #15
Mathieu
Senior Member
 
Registered: Feb 2001
Location: Montreal, Quebec, Canada
Distribution: RedHat, Fedora, CentOS, SUSE
Posts: 1,403

Rep: Reputation: 46
The -C option tells tar to put the contents in another location.
In this case /usr/local
 
  


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
can not extract the tar.gz file sharad durgawad Linux - Software 3 10-05-2005 02:41 AM
extract .tar.bz2 EcceVery Debian 3 11-24-2004 12:39 PM
How to extract a tar.gz file? deWin Linux - Newbie 3 11-10-2004 11:24 AM
tar extract fails dgermann Linux - Newbie 8 08-28-2004 11:26 AM
extract error tar.gz eye Linux - Software 6 05-18-2003 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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