O'Reilly logo

Ubuntu Server Cookbook by Uday R. Sawant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

  1. Set up key-based authentication between source and destination servers. We can use password authentication as well, which is described later in this recipe.
  2. 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}
    
  3. Now, use the following command to synchronize the entire directory from the source server to your local system. Note the / after sampledir. This will copy contents of sampledir in the backup. Without /, the entire ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required