Best Way to Compare Two Directories

I needed to compare two directories, on two machines, containing 32GB+ of thousands of files. The rsync command was what I needed.

rsync has an -i option: --itemize-changes. What it does is display a summary of all the changes. Coupled with the -n option (--dry-run) and the -r option (--recursive), it allows to efficiently compare directories, possibly over ssh.

The basic command is:

$ rsync -rin -e ssh /path/to/local/dir/ remote:/path/to/remote/dir/

The output is somewhat cryptic, but all is cleary explained in rsync’s manpage.