When it comes to copying/moving files from local machine to server and vice-versa, rsync is a fast and versatile option comparing to other protocols like scp, sftp etc.

rsync comes pre-installed to many linux distros and MacOS. But, if it’s not pre-installed in your system you can install it using your distro package manager. Here I am gonna put the command for Ubuntu and it’s other flavours since, I am using Ubuntu at the moment.

Install rsync

    sudo apt install rsync

Using rsync to copy data from/to a remote machine

Now you only need rsync installed in your local machine and the remote server to get started.

Copy from remote server

    rsync -aP username@remote_host_or_ip:/home/username/file_name.ext ~/Downloads

Copy to remote server

    rsync -aP ~/Documents/file_name.ext username@remote_host_or_ip:/home/username/

NOTE: If you haven’t set a passwordless SSH login to the remote machine, you will be asked to enter the user password.