rsync operation code example

Example 1: rsync examples

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 2: rsync

# It is a Lunux/UNIX tool to copy files to and from remote, 
# and between local directories.
# This tool is more efficient and versatile than SCP. 

rsync [options (it has a lot)] [source] [destination]

# To push
rsync [options] /tmp/myfile.txt [email protected]:/home

# To pull
rsync [options] [email protected]:/home/myfile.txt /tmp/

Handy options:
--compress --recursive --verbose