Skip to content

Instantly share code, notes, and snippets.

@jclosure
Created March 14, 2015 04:06
Show Gist options
  • Save jclosure/20d5444aedea3d7416f3 to your computer and use it in GitHub Desktop.
Save jclosure/20d5444aedea3d7416f3 to your computer and use it in GitHub Desktop.
1 liner shell command that tars a directory, pipes it through 2 ssh connections, and untars it
/usr/bin/sshpass -p mypass ssh myuser@myhost1.com -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no 'tar zcf - ./scratch/in' | \
/usr/bin/sshpass -p mypass ssh myuser@myhost2.com -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no 'tar xzf - -C ./scratch/out'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment