LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How To extract .tar.gz To A Specific Directory? (https://www.linuxquestions.org/questions/linux-software-2/how-to-extract-tar-gz-to-a-specific-directory-416752/)

George2 02-18-2006 01:48 AM

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

Thetargos 02-18-2006 02:02 AM

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.

unix_anand 02-18-2006 02:24 AM

Hi,

Try this command.

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

Thanks.

Anand.
:study:

George2 02-18-2006 06:56 AM

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.
:study:

Cool! It works for me!


regards,
George

George2 02-18-2006 07:01 AM

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


All times are GMT -5. The time now is 04:17 PM.