RSYNC

Copy a File from a Remote Server to a Local Server with SSH

To specify a protocol with rsync you need to give “ -e” option with protocol name you want to use. Here in this example, We will be using “ssh” with “ -e ” option and perform data transfer.

[root@tecmint]# rsync -avzhe ssh root@192.168.0.100:/root/install.log /tmp/ 
root@192.168.0.100's password: receiving incremental file list install.log sent 30 bytes received 8.12K bytes 1.48K bytes/sec total size is 30.74K speedup is 3.77
Copy a File from a Local Server to a Remote Server with SSH
[root@tecmint]# rsync -avzhe ssh backup.tar root@192.168.0.100:/backups/
root@192.168.0.100's password: sending incremental file list backup.tar sent 14.71M bytes received 31 bytes 1.28M bytes/sec total size is 16.18M speedup is 1.10
Copy files from a Remote Server to a Local Server with SSH and exclude file (with dry run)
[root@tecmint]# rsync -avzhe ssh --dry-run --exclude-from '/tmp/exclude.txt' root@192.168.0.100:/backups/ /tmp/

root@192.168.0.100's password: 
receiving file list ... done
./
packages

sent 515 bytes  received 111 bytes  46.37 bytes/sec
total size is 12.28K  speedup is 19.62

Source:

Slicehost: http://articles.slicehost.com/2011/2/4/migrating-a-linux-server-from-the-command-line-running-the-sync
Tecmint: http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

Leave a Reply

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