LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   extracting tar.gz command (https://www.linuxquestions.org/questions/linux-newbie-8/extracting-tar-gz-command-921921/)

gardenair 01-04-2012 12:13 AM

extracting tar.gz command
 
hi,
I have downaded a tar.gz file in my Fedora box.To extract the command i use

Code:

# tar xvfz /home/smith/foo.tar.gz
It successfully execute it show me like extracting the files when it stop I open the home folder but there was only the compress file which i have already downloaded
example:- foo.tar.gz

By default it save in /root folder. I want that after extracting it save in /home/smith folder.I try the command it it not works.

# tar xvfz /home/smith/foo.tar.gz /home/smith/

Kindly guide me that how can i save it in /home/smith folder.

thanks
gardenair

bathory 01-04-2012 12:32 AM

Hi,

The archive is extracted in the directory you were when you ran the tar command. I guess it wasn't /home/user since you used a full path.
You can use the -C option to extract the archive where you want:
Code:

tar zxvf /home/foo.tar.gz -C /some/other/directory
Regards

jhwilliams 01-04-2012 12:33 AM

That command will output the contents to the current working directory.

So, for example, if you're in directory /first/directory, and then execute the command above, the output will be in /first/directory, not in /home/.

You can use tar's -C option to output the contents to some specific place.

gardenair 01-04-2012 12:36 AM

Thanks "bathory". to solve my issue.:hattip:


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