Google News
logo
Linux - Interview Questions
What is the rsync command, and how do you use this command for synchronization?
The rsync command is used to synchronize and transfer the files in Linux. It synchronizes files between two local systems, directories, or a network. The basic rsync command contains the following :
rsync <options> <source> <destination>?

For example, let’s synchronize between Documents and the Downloads directory. For this, you need to run the following command :
rsync -av ~/Documents ~/Downloads?

If you want to go one step further, then you can use the below command :
rsync -avz --delete ~/Documents ~/Downloads?


In the above command :

* The -a option preserves all the permissions and other attributes

* The -v option displays the detailed output of the synchronization

* The -z allows compression that decreases the bandwidth use.

* The –delete option removes the file in the Downloads that do not exist in the Documents directory.
Advertisement