LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 03-28-2011, 02:33 AM   #1
Phutit
LQ Newbie
 
Registered: Sep 2007
Location: I live in South Africa.
Posts: 6

Rep: Reputation: 0
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!!!!!!!!!!!!
 
Old 03-28-2011, 02:40 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Check the -C option of tar (C uppercase).
 
1 members found this post helpful.
Old 03-28-2011, 03:35 AM   #3
Phutit
LQ Newbie
 
Registered: Sep 2007
Location: I live in South Africa.
Posts: 6

Original Poster
Rep: Reputation: 0
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...
 
Old 03-28-2011, 03:39 AM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,107

Rep: Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478
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 .
 
Old 03-28-2011, 04:06 AM   #5
Phutit
LQ Newbie
 
Registered: Sep 2007
Location: I live in South Africa.
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks,

I don' have access of GUI--how can I perform that using command.
 
Old 03-28-2011, 04:18 AM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,107

Rep: Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478Reputation: 2478
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
 
Old 03-28-2011, 04:21 AM   #7
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 291Reputation: 291Reputation: 291
Quote:
Originally Posted by Phutit View Post
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/
 
Old 03-28-2011, 09:56 AM   #8
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
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
 
  


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
[SOLVED] How to extract a tar file ? gardenair Linux - Software 18 03-12-2011 12:26 PM
extract file from tar ust Linux - Newbie 8 03-31-2009 07:23 AM
extract tar.gz file manolakis Linux - Newbie 3 11-13-2006 10:49 AM
can not extract the tar.gz file sharad durgawad Linux - Software 3 10-05-2005 02:41 AM
How to extract a tar.gz file? deWin Linux - Newbie 3 11-10-2004 11:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:13 AM.

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