5 most common Rsync command usage examples
It is used to synchronise one location to another in a simple way. Location is meant to be local directory, server or remote web server or whatever accessible by ssh.
Advantages of using rsync over other tools is speed and bandwidth requirements. First time rsync copies entire contents of the directory provided and increments changes over next sync times.
1. Synchronising local directories:Used rsync command options here:
- -z is for compression
- -v is for verbose output
- -r is for recursive directory scanning
By default rsync does not preserve timestamps.
2. Preserve timestamps and permissions during sync:
3. Synchronize from Local to Remote:It is required to specify username and ip-address of the remote server, while doing synchronization. It is also required to specify the destination directory on the remote server. The format is username@machinename:path. Sometimes depending on your credentials and ssh authentication method you may need to enter a password. Like in this example.
4. Synchronize from Remote to Local:This example is opposite to previous. we have synchronized a list of only changed files here. So speedup is relatively high.
5. View the rsync Progress during Transfer:
Running with --progress option showcase detailed progress of server interaction during load operations.
Thats it. Hope you find this article helpful to you. Comments? Suggestions?