copy file over ssh with tar

tar is usually used for achiving applications, but what we are going to do in this case is tar it then pipe it over an ssh connection. tar handles large file trees quite well and preserves all file permissions, etc, including those UNIX systems which use ACLs, and works quite well with symlinks.

the syntax is slightly different as we are piping it to ssh :

tar -cf - /some/file | ssh host.name tar -xf - -C /destination

-or with compression-

tar -czf - /some/file | ssh host.name tar -xzf - -C /destination

 

 

don't unzip

 

tar zcvf - /wwwdata | ssh [email protected] "cat > /backup/wwwdata.tar.gz"

 

or

 

tar zcvf - /wwwdata | ssh [email protected] "cat > /backup/wwwdata.tar.gz"

你可能感兴趣的:(C++,c,unix,C#,ssh)