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.
Using rsync, you can perform file and directories synchronize from one location to another location and in the local system also. Your backup server location could be on a local server or remote server.
Suggested Reading: UNIX/LINUX Command – rsync
Suggested Reading: 15 Practicle examples of rsync command in real world
Essential features of the rsync command:
Speed – As rsync command is used to sync the file to another location, So the first time, it replicates all files and data between the source and destination directories. Next time, it checks modification and changes in both location and transfers only the changed blocks or bytes of information into the destination directories, which makes the file or directories transfer fast.
Security – the rsync command support data encryption during data transfer over SSH protocol.
Less Bandwidth– During synchronization of data between source and destination it using compression and decompression of data blocks by blocks at source and destination respectively. So, due to the compression of data rsync use less bandwidth compared to any other file transfer protocol.
Privileges – rsync is a very simple application; there is no requirement for any special rights to install and execute rsync command.
For rsync command syntax and options check here.
rsync command examples
Exampel 1 – Two directories synchronize in local server
$ rsync – zvr /var/www/website/ /root/tmp building file list … done index.html home.html . sent 567890 bytes received 67890 bytes 456789.00 bytes/sec total size is 895678 speedup is 1.78 $
Example 2 – Only one file Synchronize
$ rsync –v /var/www/website/ssl.cert /root/temp ssl.cert sent 64 bytes received 34567 bytes 3462.18 bytes/sec total size is 23456 speedup is 1.32 $
Example 3 – Synchronize files to remote server from local system
$ rsync –avz /root/temp/ firstname.lastname@example.org:/home/linuxconcept/temp/ Password: building file list … done ./ satish/ satish/test.txt satish/test001.txt sent 23456782 bytes received 567 bytes 245673.34 bytes/sec total size is 56345784 speedup is 3.54 $
Example 4 – Synchronize Files from remote server to local system
$ rsync –avz email@example.com:/var/lib/mysql /root/temp Password: receiving file list … done mysql/ mysql/mysql.mdb . sent 567 bytes received 5634526 bytes 523325.45 bytes/sec total size is 563454525 speedup is 1.36 $