Skip to content

Instantly share code, notes, and snippets.

@nicholashoule
Last active June 6, 2019 19:33
Show Gist options
  • Save nicholashoule/09d58014fc0280a3ff9afaf501431a64 to your computer and use it in GitHub Desktop.
Save nicholashoule/09d58014fc0280a3ff9afaf501431a64 to your computer and use it in GitHub Desktop.
Rsync and SSH

Rsync and SSH

PULL FROM REMOTE HOST (DOWNLOAD):
rsync -ravz -e ssh [email protected]:/opt/ /home/user/directory/
rsync -avz -e "ssh -A -i /home/user/.ssh/id_rsa" [email protected]:/data /home/user/projects/data
PUSH TO REMOTE HOST (UPLOAD):
rsync --help

Options
 -v, --verbose               increase verbosity
 -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
 -r, --recursive             recurse into directories
 -n, --dry-run               perform a trial run with no changes made
...
 -c, --checksum              skip based on checksum, not mod-time & size
 -u, --update                skip files that are newer on the receiver
 -z, --compress              compress file data during the transfer
 ...
 
rsync --update -ravz -e ssh /home/user/directory/ [email protected]:/opt/
rsync -avz -e "ssh -p 10010" /home/user/directory/ [email protected]:/opt/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment