- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- tar extract to different directory
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 04:49 AM
тАО10-18-2001 04:49 AM
tar extract to different directory
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 04:55 AM
тАО10-18-2001 04:55 AM
Re: tar extract to different directory
tar xvf
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 04:56 AM
тАО10-18-2001 04:56 AM
Re: tar extract to different directory
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 05:06 AM
тАО10-18-2001 05:06 AM
Re: tar extract to different directory
If the backup was ABSOLUTE, meaning, when you do a "tar -tvf
From the man pages of tar:
There is no way to restore an absolute path name to a relative position.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 05:08 AM
тАО10-18-2001 05:08 AM
Re: tar extract to different directory
tar -cf /tmp/tar.ball /var
but if you did
cd /var
tar -cf /tmp/tar.ball filespec
you can put them anywhere that you have cd'd to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 05:17 AM
тАО10-18-2001 05:17 AM
Re: tar extract to different directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 05:19 AM
тАО10-18-2001 05:19 AM
Re: tar extract to different directory
1. How do I untar a file with absolute paths to a relative location?
a. Method 1 (user)
1. /usr/bin/pax -r -s ',^/,,' -f file.tar
b. Method 2 (root)
1. /usr/bin/cp /usr/sbin/static/tar /tmp
2. /usr/bin/dd if=file.tar | /usr/bin/chroot /tmp ./tar xf -
from :
http://shells.devunix.org/~argoth/iaoq/#I.A1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 05:22 AM
тАО10-18-2001 05:22 AM
Re: tar extract to different directory
If the 'tar' archive was created with absolute paths, then you can't use 'tar' to extract to a different directory.
*However*, try this with 'pax':
# mkdir newdir
# cd olddir
# pax -rw olddir newdir
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 05:26 AM
тАО10-18-2001 05:26 AM
Re: tar extract to different directory
/usr/bin/pax -r -s ',^/,,' -f file.tar
But first cd into the directory you want to restore to. If the archive was absolute: /tmp/somefilename, and you cd to /opt, it will restore "somefilename" to /opt/tmp/.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 06:03 AM
тАО10-18-2001 06:03 AM
Re: tar extract to different directory
Being in UNIX Busines for years, but never heard about pax. Something one should definately know about. Thanks James (this is clearly worth 10 points).
Until now, my workaround has always been to track the pathnames, and then move away one of the lower directories temporary, substituting this directory by a symlimk pointing to my intended target. What a mess sometimes.....
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-18-2001 07:48 AM
тАО10-18-2001 07:48 AM
Re: tar extract to different directory
Hope this helps.
-Santosh