Skip to content

Instantly share code, notes, and snippets.

@KryptikOne
Last active September 24, 2018 20:58
Show Gist options
  • Select an option

  • Save KryptikOne/4bc40033ca6ee9d9bc44318da0bd5b0c to your computer and use it in GitHub Desktop.

Select an option

Save KryptikOne/4bc40033ca6ee9d9bc44318da0bd5b0c to your computer and use it in GitHub Desktop.
RSync with pem file
============================
LOCAL <- REMOTE
============================
Need to grab the contents of a directory?
If you add the / at the end of the remote path, rsync will grab the contents of the directory
===============================================================
rsync -avLP -e "ssh -i NAME_OF_PEM_FILE.pem" [email protected]:/var/www/blah/blah/ ~/Downloads/SomeLocalFolder
Need to grab the parent directory?
If you omit the / it will grab the parent folder itself
===============================================================
rsync -avLP -e "ssh -i NAME_OF_PEM_FILE.pem" [email protected]:/var/www/blah/blah ~/Downloads/SomeLocalFolder
Need to grab a specific file?
Just specify the exact filename and extension and it will grab the file only
===============================================================
rsync -avLP -e "ssh -i NAME_OF_PEM_FILE.pem" [email protected]:/var/www/blah/blah/some_database_file.sql ~/Downloads/SomeLocalFolder
============================
LOCAL -> REMOTE
============================
rsync -avLP -e "ssh -i NAME_OF_PEM_FILE.pem" ~/Downloads/SomeLocalFolder [email protected]:/var/www/blah/blah/SOME_REMOTE_FOLDER/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment