Rsync: Copying files across machines

rsync -azP <remote-machine>:<remote-path> <local-path>

Rsync is usually faster than scp. Here are what the options mean:

As far as I can tell, here are the benefits of scp over this approach:

If we were being very semantic and you wanted to just copy a file over, scp is the right tool and does not try to do any of the smart optimizations to speed up the copy process that rsync does - like checking mod-time and size of local file before deciding if it should be copied over from the remote machine. rsync is a tool for synchronizing directories across machines. However, for most situations - it works quite well as a replacement for scp.

Update: Turns out you could use scp -C option to enable compression on scp to bring it more in line with the -z option of rsync. Rsync still has the other benefits such as preserving file attributes, optimizing what to transfer based on local presence of the file etc.

References:

--

--

Adventuring through life. Stories of software development, engineering, fun, and reflection.

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
Aishwar Muthuraman

Adventuring through life. Stories of software development, engineering, fun, and reflection.