How to use rsync with compression to save bandwidth?

Published on Aug. 22, 2023, 12:18 p.m.

To use rsync with compression to save bandwidth, you can use the -z or --compress option in the command. This option tells rsync to compress data during transfer, which can greatly reduce the amount of data that needs to be transferred, especially for larger files. Here is an example command:

rsync -avzh source/ destination/

This command will sync the source directory with the destination directory, compressing data during transfer to save bandwidth. Note that the -avzh flags are additional options commonly used with rsync to copy files recursively, preserve permissions and timestamps, and show human-readable output.

It’s worth noting that compression can add some overhead to the transfer process, so while it can be helpful in some cases, it may not always be the most efficient choice. You can use tools like iperf or nload to monitor the network bandwidth before and after the addition of the -z option to test if it is offering any real benefit.

Tags: