[CentOS] remote tar via ssh

Stephen Harris lists at spuddy.org
Wed Sep 26 19:27:40 UTC 2007

On Wed, Sep 26, 2007 at 03:22:02PM -0400, Von Landfried wrote:
> I copied this from <http://happygiraffe.net/copy-net> which is a nice  

> tar -cf - /some/file | ssh host.name tar -xf - -C /some/place/cool

Do not use "/some/file"  - Although GNUtar (the version on CentOS) will
strip off the leading / on extraction, it's a bad habit to get into
and _will_ bite you in the foot if you ever use a different version of tar.

Also, depending, a "p" flag on extraction might be useful.

Personally I also "cd" rather than -C on extraction.  So

  cd /source/directory
  tar cf - . | ssh RemoteHost "cd /dest/directory && tar xfp - "



More information about the CentOS mailing list