Pipe tar over ssh

From Wiki
Jump to: navigation, search

Here is how to tar up a VPS environment and copy the file to another server.

cd /vz/private/1xx/root
tar cvf - . | ssh root@dc1-vps2-151 "cat > /vz/tmp/109.tar"

netcat can be used instead of ssh for faster transfers:

sender:

tar cf - /data | nc -l 7878

receiver:

nc -w 10 192.168.10.3 7878 | tar -C / -xpvf -