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:


tar cf - /data | nc -l 7878


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