How to use rsync on a Linux VPS


Rsync is a file-copying tool which allows you to copy or synchronize files and directories on a local or remote system. It is fast and offers large number of options. In this tutorial we will show you how to use rsync on a Linux VPS.

These are some of the basic features of rsync:

– Rsync supports copying links, devices, owners, groups, and permissions.
– Rsync can use any transparent remote shell. For example, SSH or RSH.
– Rsync does not require super user privileges and can be used by regular system users.

Rsync is installed by default with all our Linux VPS hosting plans. However, if you do not have rsync installed on your system, it is really simple to do that. First of all, log in to your server via SSH:

If you like to install rsync on an Ubuntu VPS, run the following commands:

# apt-get update && apt-get -y upgrade
# apt-get -y install rsync

If you like to install rsync on a CentOS VPS, run the following commands:

# yum -y update
# yum -y install rsync

Once you have rsync installed on your system you can start using it. The basic syntax of rsync is the following:

# rsync option source destination

Rsync has a lot of options which can be used to control every aspect of its behavior. For a full list of options available in rsync you can check the man page:

# man rsync

Here is a short list of some of the most commonly used options available in rsync:

-a, --archive               archive mode
-v, --verbose               increase verbosity
-z, --compress              compress file data during the transfer
-t, --times                 preserve modification times
-p, --perms                 preserve permissions
-h, --human-readable        output numbers in a more human-readable format
-l, --links                 copy symlinks as symlinks
-e, --rsh=COMMAND           specify the remote shell to use
--numeric-ids           don't map uid/gid values by user/group name
--delete                delete extraneous files from dest dirs

To copy a directory from one location to another on your local system using rsync you can execute the following command:

# rsync -avh /tmp/foo /tmp/bar/

This command will copy the /tmp/foo/ directory inside /tmp/bar/. If you just like to copy the files inside /tmp/foo/ to /tmp/bar/ then you can use the command:

# rsync -avh /tmp/foo/ /tmp/bar/

To copy a directory from you local machine to a remote machine you can use the same syntax, except that you will need to specify the destination address and the remote system user. For example, to copy the local /tmp/foo/ directory inside /tmp/bar/ on a remote machine with IP address using admin as username, you can use the following syntax:

# rsync -avh /tmp/foo admin@

Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to help you with using rsync on your server. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install GitBucket on Ubuntu 16.04
Install MyBB on Ubuntu 16.04
Install Node.js and create your first Express application
There are currently no comments.