Performing a dry run with rsync


One of the many useful options rsync offers is the ability to do a dry-run – in effect showing you what it would do without actually making any changes. To achive this we use the -n flag, like so:


rsync -n /source /destination


In practice we would likely use the -n switch in combination with other switches – commonly we use -avzP, so our real-world example would look like this:


rsync -avzP -n /source /destination


Thanks to the verbose flag (-v) you should see a full list of all of the files which would be transferred, as well as the final note on the last two lines:


sent 26457 bytes  received 2086 bytes  19028.67 bytes/sec
total size is 26377806232  speedup is 924142.74 (DRY RUN)


…letting you know that it was a dry run and that no files were transferred.