rsync is the better SCP
How are you transferring files to remote servers, only accessible via SSH? Are you still using SCP? Are you tired of watching the file upload with 23 KiB/s? Fear no more! rsync to the rescue!
rsync is cp supercharged. It’s fast, correct, and can be used to copy/move/archive files to remove machines via SSH.
Instead of
use
Of course, in typical fashion, you can also download files from the remote, by switching the order of the last arguments.
Let’s quickly walk through the arguments to rsync before I present you with a simple shell alias that simplifies this:
-a: Preserve owner, permissions, and other metadata.-v: Verbose. Print more information.-z: Compress the file locally so that less bytes need to be transferred.-h: Output numbers in human readable format, so 2 MiB/s instead of 2097152 bytes/s.--info=progress2: Show progress.
rsync has many more useful options, consult man rsync for more information.
To simplify remembering the rsync command-line (or, avoid RSI by typing too much), you can use the function below to simplify it:
# usage: rscp -i path/to/key $SRC $DEST
Add it to your .zshrc or .bashrc/.bash_profile and invoke like scp: