Tag Archives: Linux

Rsync tutorial: How can I keep two computers’ data synched?

You can use rsync of course. It is very simple to use.

Make sure you have it installed. On a RHEL box you can do: sudo yum install rsync or on an Ubuntu box you can do sudo apt-get install rsync. This can even be done on a Windows box but you will need to have Cygwin installed. On Windows once you have Cygwin installed you can install SSH and Rsync on it.

Next, make sure you have ssh installed. Here is how to do it with Ubuntu: link. With RHEL you can do: sudo yum install ssh.

Make sure you can ssh from the source box to the target server. If you need help doing this, see this link.

Next you can run these commands:

rsync –verbose –progress –stats –compress –rsh=/usr/local/bin/ssh \
–recursive –times –perms –links –delete \
–exclude “*bak” –exclude “*~” \
/www/* webserver:simple_path_name

  • –verbose : shows a lot of information
  • –progress : shows progress in percentage of time almost completed
  • –stats : shows amount of time taken and time sped up
  • –compress : compresses data so that it can be sent faster
  • –rsh : tells which login program you’re going to use — in our case this is ssh.
  • –recursive : tells rsync to sync up subfolder data as well
  • –times : preserves time stamp of files and folders for the new server
  • –perms : preserves permissions of files and folders for the new server
  • –links : copies over symbolic links
  • –deletes : will delete files on the target server if they do not exist on the source server
  • –exclude “[filename]” : will not sync a file/folder given here

A few other resources: