How to do it...

In this section, we will see how to use rsync and grsync to synchronize files/directories locally, as well as remotely from one system to another.

  1. Let's start by creating two test directories on one system and also create some test files inside one of the directories. To do this, we run the following commands:

Here, we have created two directories, dir1 and dir2, and dir1 has five empty files created inside it.

  1. If we want to sync the contents of dir1 to dir2 locally, we can do so by using the following command:

The -r option ...

Get Practical Linux Security Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.