Home –  How to – Backup your Linux remotely using rsync command

Backup your Linux remotely using rsync command

rsync is a command in Linux which stands for remote sync. It is used for backing up the data. It synchronizes the directories and files from one location to another in a good way. The backup destination could be either on local or on remote server.


  • Speed: rsync replicates all the data from source to destination and then it transfers only the changed blocks/bytes to the destination. This makes the transfer fast.
  • Security: It uses encryption using ssh technique.
  • Bandwidth: It compresses the block at source and then at the receiving end it decompresses the block. It transfers the data block by block using compression and decompression at source and destination side respectively. Hence uses less bandwidth.
  • Privileges: No extra privileges are required to use rsync.


$ rsync options source destination

Case 1: Synchronize two directories in local server

use rsync -zvr command (z to enable compression, v for verbose, r for recursive)

$ rsync -zvr /var/opt/installation/inventory/ /root/temp

The above command does not preserves the timestamp.

Case 2: Preserve timestamps using rsync -a

The -a options preserves symbolic links, permissions, timestamp, owner and group.

$ rsync -azv /var/opt/installation/inventory/ /root/temp/

Case 3: Synchronize only a single file

Specify the file name to the rsync command

$ rsync -v /var/lib/rpm/Pubkeys /root/temp/

Case 4: Synchronize files Local->Remote

$ rsync -avz /root/temp/ chankey@

Case 5: Synchronize files Remote->Local

$ rsync -avz chankey@ /root/temp

Case 6: Select remote shell

$ rsync -avz -e ssh chankey@ /root/temp

rsync -e ssh => uses the ssh shell for remote sync

Case 7: Do not overwrite modified file at destination

If the file at the destination is modified and if we don’t want to change it back to the old one again then using rsync -u option.

$ rsync -avzu chankey@ /root/temp

Case 8: Synchronize only the directory Tree structure (not files)

use rsync -d option for this purpose.

$ rsync -v -d chankey@ .

Case 9: Do not create new file at destination, just update existing files

use --existing option

$ rsync -avz --existing root@ .

Case 10: Transfer the entire file

use rsync -W option

#  rsync -avzW  chankey@ /root/temp

2 thoughts on “Backup your Linux remotely using rsync command

Leave a Reply to Sathishkumar Cancel reply

Your email address will not be published. Required fields are marked *