The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How do I untar file through an ssh session? Joe McCaughan UNIX for Advanced & Expert Users 3 05-28-2008 12:01 PM
Tar utility (untar a .tar file) on VxWorks uday_01 UNIX for Advanced & Expert Users 1 05-26-2008 06:13 AM
unable to UNTAR a file NIMISH AGARWAL UNIX and Linux Applications 6 05-08-2008 08:35 PM
Untar a TAR file at different location malaymaru UNIX for Dummies Questions & Answers 5 09-18-2006 05:59 PM
unTar a specific file from remote gelbvonn Shell Programming and Scripting 2 05-25-2006 12:59 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2006
Registered User
 

Join Date: Nov 2006
Posts: 187
untar to a specified file

I have file1.tar and want to untar it under /server/file2.

If I do tar -xvf file1.tar, the files will be deployed under file1.

How to specify the destination folder??
thx
Reply With Quote
Forum Sponsor
  #2  
Old 11-27-2006
Registered User
 

Join Date: Nov 2006
Posts: 39
I suggest to place the tar file in the directory you would like the files to be untarred to. Then when you untar the files should be placed in that directory.
The exception is if the files were tarred with / preceding the path. Then the files will be untarred to the root directory.

You can determine where the files will be untarred by using the t option.
tar -tvf files.tar will show you the paths of where the files will be untarred.
Reply With Quote
  #3  
Old 11-27-2006
Registered User
 

Join Date: Nov 2006
Posts: 187
thx. So I understand from you that I can't specify the location when untaring. Right??

thx
Reply With Quote
  #4  
Old 11-27-2006
Registered User
 

Join Date: Nov 2006
Posts: 39
Its more like this. If you do a tar -tvf and you see that the paths are
myfiles/file1.txt
myfiles/file2.txt
if you put the tar file in /usr and extract it then the path for the files become
/usr/myfiles/file1.txt
/usr/myfiles/file2.txt

the only exception is if you do a tar -tvf and you see the paths are
/myfiles/file1.txt
/myfiles/file2.txt
then because of that leading / the file path for the files will become
/myfiles/file1.txt
/myfiles/file2.txt
no matter where you extract the tar.

Hope that makes makes it easier
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0