LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   extract the tar file (https://www.linuxquestions.org/questions/linux-newbie-8/extract-the-tar-file-871392/)

Phutit 03-28-2011 02:33 AM

extract the tar file
 
Hi Guys,

How do I extract a tar file from one directory to another.

e.g /data1/test.tar to /data2

Thanks....

Please help!!!!!!!!!!!!

colucix 03-28-2011 02:40 AM

Check the -C option of tar (C uppercase).

Phutit 03-28-2011 03:35 AM

Thanks for the reply...

Lest say I have the file like /data1/test.tar and I normally use tar -xvf test.tar.

Now I want to untar this file to a different directory...how do I redirect the extract to that directory?

Thanks...

John VV 03-28-2011 03:39 AM

if this is a terminal only headless set up then use the terminal
BUT
if you have gnome or KDE installed ( or any desktop environment)
why not use the gui
for Gnome that is "file-roller"

just double click on the tar file and use that .

Phutit 03-28-2011 04:06 AM

Thanks,

I don' have access of GUI--how can I perform that using command.

John VV 03-28-2011 04:18 AM

the very first step would to read the output of two commands
the man page and the help page
Code:

tar --help
-- then this --
man tar

all this is explained in the program manual ( man tar)
and in the help ( -- help)

almost every ( about 99.9% ) linux program has a help page .
and most have a manual

tommcd 03-28-2011 04:21 AM

Quote:

Originally Posted by Phutit (Post 4305966)
I don' have access of GUI--how can I perform that using command.

It would go like this:
Code:

tar -xvf /data1/test.tar -C /data2/

SL00b 03-28-2011 09:56 AM

Alternatively, you could navigate to the target directory and execute the tar command from there. That's pretty much what the -C option does anyway.

Code:

cd /data2
tar -xvf /data1/test.tar



All times are GMT -5. The time now is 06:14 PM.