Skip to content

Instantly share code, notes, and snippets.

@jmillerdesign
Created January 16, 2014 18:36
Show Gist options
  • Save jmillerdesign/8460671 to your computer and use it in GitHub Desktop.
Save jmillerdesign/8460671 to your computer and use it in GitHub Desktop.
Useful to move many files (thousands or millions files) over ssh. Faster than scp because this way you save a lot of tcp connection establishments (syn/ack packets).
tar -cf - relative/path/to/dir | gzip -c | ssh user@example.com 'cd ~/path/to/dir; tar xfz -'
# If using a fast lan (I have just tested gigabyte ethernet) it is faster to not compress the data so the command would be:
# tar -cf - relative/path/to/dir | ssh user@example.com 'cd ~/path/to/dir; tar xf -'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment