How to use Rsync to copy or sync files between your servers?

Rsync is a very useful and widely used tool that can be used to transfer or synchronize files between local and remote servers. Rsync commands are executed through the shell, so an active Linux server is required, as well as an SSH client such as Terminal or PuTTY (for Windows). This tool is usually pre-installed into many Linux Operating Systems, however, it is possible to install it by running sudo apt install rsync on Ubuntu and Debian or by executing sudo yum install rsync on CentOS and Fedora.

The default syntax of file transfer using rsync is very simple

rsync [option] [source] [destination]

Here are some of the many options available:

-a | copy files recursively
-h | produce a readable output
–progress | displays the process while the command is being run
-q | processes running in the background will not be shown
-v | processes that are run will be written out for the user to read
-z | compress the data

More available options can be visible by running rsync –help

To send files from local source to a remote server, you may follow this format

rsync [option] [source] user@hostname-or-ip:[destination path]

For instance:

rsync -avh /home/test-rsync/ root@
rsync directory

In this example above, we are copying test-rsync directory contents from a local server to a remote server Files will be transferred to receive-rsync directory on the new server while displaying the progress on the local server.

It is also possible to send files from a remote origin to a local server

A simple change in syntax will do the opposite:

rsync -avh root@ /home/test-rsync/ 
File list

In this case, we have copied files from a remote server to our local directory local-file-directory.

Keep in mind that in both cases, we had to use the SSH password of a remote server for verification.

This is an easy way to migrate your files between the servers or easily sync them. However, it is important to note that this tool only transfers files but not services or packages so in case you are migrating from one server to another, make sure to manually install them.

If any further questions arise, make sure to contact our customer support team at or create a ticket directly from your Terminal -> Support -> Tickets.

Was this article helpful?

Need support?

If you need any further help, don't hesitate to send a support request to our support team.