- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- relitive tar | gzip
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
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
тАО12-04-2009 12:54 PM
тАО12-04-2009 12:54 PM
tar -cf - /path/to/myfile.txt | gzip -9 > /archive/myfile.tgz
I know I can do cd /path/to and do my tar and my gzip and it will be relative.
But I was wondering if there was a way to tar it as a relative tar file without having to cd into the directory. But doing it from the tar command.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2009 01:29 PM
тАО12-04-2009 01:29 PM
Solutionpax -rvf /tmp/backup.tar
This extracts files to the current directory.You can add one or more -n
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2009 02:11 PM
тАО12-04-2009 02:11 PM
Re: relitive tar | gzip
> directory. [...]
Who cares? How hard is it to do it with a
"cd" command?
( cd /path ; tar -cf - to/myfile.txt ) | \
gzip -9 > /archive/myfile.tgz
Where's the problem?
Or use GNU "tar", which has a "-C = dir"
("--directory=dir") option:
http://www.gnu.org/software/tar/manual/html_node/Option-Summary.html#SEC42
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2009 06:39 PM
тАО12-04-2009 06:39 PM
Re: relitive tar | gzip
Read tar(1)?
tar -cf - -C /path/to myfile.txt | gzip -9 > /archive/myfile.tgz
Unfortunately this is one good thing about tar that isn't in pax(1). But pax has -s.
>Bill: not with the standard tar command.
I think you misinterpreted PBSG's question.
>You can use pax to restore files from a tar archive into a different directory:
Yes, you need to use -s.
> Steven: How hard is it to do it with a
"cd" command?
It was hard enough they added -C to tar. :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-05-2009 08:15 AM
тАО12-05-2009 08:15 AM
Re: relitive tar | gzip
"-C" has the advantage that you can use it
more than once in the list of files. I can't
say that I've ever wanted to do that with
"tar", but I have with mkisofs, so I can
imagine situations where it might be handy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2009 06:50 PM
тАО12-06-2009 06:50 PM