Identify differences between directories (possibly on different servers)

diff <(ssh server01 'cd config; find . -type f -exec md5sum {} \;| sort -k 2') <(ssh server02 'cd config;find . -type f -exec md5sum {} \;| sort -k 2')
This can be much faster than downloading one or both trees to a common servers and comparing the files there. After, only those files could be copied down for deeper comparison if needed.
Sample Output
< 5955632baf6598bd56668bf45aae31c3  ./
< 54ba5e4ebe18ef4855fa2796dfb2521e  ./logging.xml
< 388a7f1823574252e26ddbdbd68a02bf  ./
> 165768e0b454c90ab1b26150b7954fd2  ./
> 0ad95a5ab764bfdede2dc713f84ecfc0  ./logging.xml
> 636d9444bc20ffe2dc2433b90b2535e7  ./

By: arcege
2009-09-11 15:24:59

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: