LinuxQuestions.org
Register a domain and help support LQ
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 02-18-2006, 01:48 AM   #1
George2
Member
 
Registered: Oct 2003
Posts: 354

Rep: Reputation: 30
How To extract .tar.gz To A Specific Directory?


Hello everyone,


The command "tar -zxvf foo.tar.gz" will extract the tar file foo to the current directory. I am wondering how to extract the tar file to a specific directory.


thanks in advance & have a good weekend,
George
 
Old 02-18-2006, 02:02 AM   #2
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Rep: Reputation: 45
That's very simple, try the command:

Code:
tar zxf -C /some/dir foo.tar.gz
Edit:
By the way, the -C /path can be placed after the file itself too.
 
Old 02-18-2006, 02:24 AM   #3
unix_anand
LQ Newbie
 
Registered: Dec 2004
Location: Mumbai - India
Posts: 9
Blog Entries: 1

Rep: Reputation: 0
Hi,

Try this command.

tar -zxvf <tar file name> -C /<directory Name you want to restore>.

Thanks.

Anand.
 
Old 02-18-2006, 06:56 AM   #4
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
unix_anand,


Quote:
Originally Posted by unix_anand
Hi,

Try this command.

tar -zxvf <tar file name> -C /<directory Name you want to restore>.

Thanks.

Anand.
Cool! It works for me!


regards,
George
 
Old 02-18-2006, 07:01 AM   #5
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Thetargos,


Quote:
Originally Posted by Thetargos
That's very simple, try the command:

Code:
tar zxf -C /some/dir foo.tar.gz
Edit:
By the way, the -C /path can be placed after the file itself too.
I found that your command does not work. But the following command works,

tar zxf foo.tar.gz -C /some/dir


regards,
George
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Searching a specific directory for a specific extension? RoaCh Of DisCor Linux - Newbie 3 08-13-2005 03:28 PM
using tar to extract properly xushi Slackware 9 03-05-2005 09:10 AM
tar extract fails dgermann Linux - Newbie 8 08-28-2004 11:26 AM
Extract specific files from .tgz dgermann Linux - Newbie 6 08-25-2004 10:39 AM
Choosing where to extract tar.gz Arclite Linux - Software 14 08-14-2003 03:57 PM


All times are GMT -5. The time now is 07:26 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration