rsync ssh code example

Example 1: rsync ssh

# You'll need to fill in a username, the user's IP address, 
# and a file/directory to recieve
rsync -av remote-user@<IP address>:/path/to/remote/file /local/destination

Example 2: linux rsync example

The rsync command stands for Remote Synchronization.

The Linux command rsync is used to do a backup operation and fast copy file into the local system or remote system in UNIX/Linux.

rsync command examples

# rsync options source destination

$ rsync – zvr /var/www/website/   /root/tmp
$ rsync –avz /root/temp/ [email protected]:/home/linuxconcept/temp/
$ rsync –avz [email protected]:/var/lib/mysql /root/temp

Example 3: rsync with ssh key

# This way you can do the job with your SSH key

rsync -Pav -e "ssh -i $HOME/.ssh/somekey" username@hostname:/from/dir/ /to/dir/

Tags:

Misc Example