Viewing the differences between two directories on Linux servers


This past week I needed to compare the contents of two directories to see if there were any differences. There are a TON of ways to do this, though my preferred way is to use diff with the “-r” (when comparing directories do so recursively) option to compare two folders:

$ find foo1

foo1
foo1/services2
foo1/services

$ find foo2

foo2
foo2/services

$ diff -r foo1 foo2

Only in foo1: services2

Simple, easy and it gives you the output you’re most likely after. Anyone found a simpler solution that this? :)

This article was posted by Matty on 2011-05-21 08:27:00 -0400 EDT