Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-04-2012, 12:13 AM   #1
Registered: Oct 2004
Location: LH
Posts: 648

Rep: Reputation: 45
extracting tar.gz command

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

# 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.


Last edited by gardenair; 01-04-2012 at 12:33 AM.
Old 01-04-2012, 12:32 AM   #2
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,827

Rep: Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866Reputation: 1866

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:
tar zxvf /home/foo.tar.gz -C /some/other/directory
1 members found this post helpful.
Old 01-04-2012, 12:33 AM   #3
Senior Member
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
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.
Old 01-04-2012, 12:36 AM   #4
Registered: Oct 2004
Location: LH
Posts: 648

Original Poster
Rep: Reputation: 45
Thanks "bathory". to solve my issue.


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
[SOLVED] tar.gz not extracting gardenair Linux - Networking 6 02-03-2011 05:05 AM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
extracting tgz.tar abhipro Linux - Newbie 8 10-30-2009 04:29 PM
After extracting a tar useless? glenn69 Linux - Newbie 6 04-23-2004 09:04 PM
Extracting multivolume tar Cichlid Linux - Software 3 12-21-2003 01:54 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration