Synchronizing files with Rsync
In this recipe, we will learn how to use the Rsync utility to synchronize files between two directories or between two servers.
How to do it…
Follow these steps to synchronize files with Rsync:
- Set up key-based authentication between source and destination servers. We can use password authentication as well, which is described later in this recipe.
- Create a sample directory structure on the source server. You can use existing files as well:
ubuntu@src$ mkdir sampledir ubuntu@src$ touch sampledir/file{1..10}
- Now, use the following command to synchronize the entire directory from the source server to your local system. Note the
/
aftersampledir
. This will copy contents ofsampledir
in thebackup
. Without/
, the entire ...
Get Linux: Powerful Server Administration now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.