Rsync linux command
Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behaviour and permit very flexible specification of the set of files to be copied.
Rsync is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.
Syntax: rsync <option> <source> <destination>
Some helpful commands of rysnc
Syncing a local directory to a remote computer
~#rsync -avz /home/localdir root@168.88.22.11:/home/remotedir
Syncing remote folder to local computer
~#rsync -avz username@168.88.22.11:/home/remotedir /home/localdir
Syncing a directory on the same computer
~#rsync -avz /home/user1 /afolder/
Rsync over SSH
Rsync over SSH is a secure way to transfer file accross computers or from one location to another (using internet). Personally I find it faster than scp. Example below will allow you to copy a file from your computer to a remote location
~#rsync -avhe ssh -p <SSH PORT if not default> /home/localdir root@168.88.22.11:/home/remotedir
How to see data transfer progress with rsync.
Simply add –progress to the command above
~#rsync -avhe ssh –progress /home/localdir root@168.88.22.11:/home/remotedir
Its always a good idea to do a dry run before actually running your rsync command.
You may be interested in:
Learn more about rsync man page