Use any one of the following commands to install rsync. If you are using Debian or Ubuntu Linux, type the following command:
apt-get install rsync
RHEL / CentOS 5.x or newer user type the following command:
yum install rsync -y
Since rsync does not provide any security while transferring data it is recommended that you use rsync over ssh session. This allows a secure remote connection.
Example of commands
Copy file from a remote server to a local computer:
rsync -v -e ssh root@server.server.tld:~/file.html /tmp
Synchronize a local directory with a remote directory:
rsync -r -a -v -e "ssh -l root" --delete /local/folder server.server.tld:/folder
Synchronize a remote directory with a local directory:
rsync -r -a -v -e "ssh -l root" --delete server.server.tld:/folder/ /local/folder
Synchronize a local directory with a remote rsync server or vise-versa:
rsync -r -a -v --delete rsync://sync.server.server.tld/folder /home/folder
Mirror a directory between my "old" and "new" web server/ftp:
rsync -zavrR --delete --links --rsh="ssh -l root" my.old.server.tld:/home/folder /home/folder