Speeding Up Network File Transfers with rsync

Install rsync

apt install rsync
zypper install rsync
yum install rsync

rsync Local to Local Synchronization

rsync [options] /path/to/source_file /path/to/destionation_file
rsync -P /bin/cat /tmp
rsync -r /bin /tmp
rsync -rv /bin /tmp

Effect of Trailing Slash / in rsync

rsync -r /bin/ /tmp
rsync -r /bin /tmp

rsync Between Local and Remote Destination

Using rsync with Password Based Logins

rsync -v /bin/ls root@
rsync [options] /path/to/local/file_or_directory remote_username@IP_ADDRESS_OR_DNS_HOSTNAME:/path/to/destination
root@alibaba-ecs:~# rsync -v /bin/ls root@
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:bfmHI3x/TA5F2NFdxlXg5aMFh22HbdjE7FJdbfv8UKw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
root@'s password:
sent 130,830 bytes received 35 bytes 23,793.64 bytes/sec
total size is 130,736 speedup is 1.00
rsync -v root@ /tmp

Using rsync with Private Key Based Logins

mkdir ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
rsync -v /bin/ls root@

Use rsync Archive Mode and Compression to Speed Up Transfers

rsync -avPz root@ /tmp/

rsync Command Line Options



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store