How To Synchronize Files using rsync Command

Rsync is a free software/package that is used for synchronizing and copying directories and files locally as well as remotely.

By Default Port # 873

Install rsync

Install rsync package on server.

For RedHat/CentOS/Fedora

# yum install rsync

For Debian/Ubuntu

# apt-get install rsync

Basic syntax of rsync command

Here is the basic syntax of writing rsync command

# rsync options source destination

Rsync Directory/File on Local Machine

To Rsync Directory/File on Local Machine execute the following command.

# rsync -r dir1/ dir2

Rsync Directory/File on Remote Machine

To Rsync Directory/File on Remote Machine execute the following command.

# rsync -avzhe username@IP-Address:/remote-directory /local-directory

Set Cronjob for Sync Directory/File on Remote Machine

To Set Cronjob Rsync Directory/File on Remote Machine execute the following command.

*/45 * * * * rsync -avzhe ssh username@IP-Address:/remote-directory /local-directory

Leave a Reply

avatar
  Subscribe  
Notify of