Faster File Copy Using Tar and SSH

How to quickly copy a file or directory over SSH using tar:

tar -cf - myfile | ssh target_host tar -xf -

If you want to change the target directory, use this:

tar -cf - myfile | ssh target_host “cd /target_dir; tar -xf -”

Leave a Reply