Magic Tar

July 20, 2005 on 3:53 pm | In Sysadmin |

People ask me all the time what the hell is ‘magic tar’ and why should anyone use it. I learned about this from a sys-admin at the University of Colorodo, Boulder - Andrew Scrivner - and have always been thankful for it.

Here is a sample of the command:

Magic Tar:
tar cf - . | (cd /where; tar xf -)

Here is the same command modified to run over SSH:

Magic Tar over SSH:
tar cf - . | ssh user@host "cd /where; tar cf -"

Use it or suffer from losing permissions, links, owner/group, etc…

2 Comments

  1. another version:

    tar cf - . | ssh user@host tar -C /where xf -

    even better:

    rsync -avP ./ user@host:/where/

    If your connection dies in the middle, just re-run the command and you’re good.

    Comment by shavenwarthog — March 8, 2006 #

  2. Thanks for the comment.

    rsync is grand - but tar is more widely available. A lot of machines don’t have rsync by default.

    But rsync does continue uploading if interrupted - so it’s got that going for it. Personally, I use unison for my more-complicated syncing needs.

    Comment by admin — March 8, 2006 #

Sorry, the comment form is closed at this time.

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^