Is there a Terminal shell command to compare the contents of folders?
Sometimes you may want to see the differences in folders in order to:
- See what files are different
- See what files are missing
- See what files have been added
Which may prove useful if you wish to keep the contents of two folders the same, or to show if files have changed between the local and remote copy of the folder.
Is there a way to show this comparison using Terminal or otherwise?
Yes. The diff
command will do exactly what you want. To use it just type diff -rq
and either drag the folders you want to compare into the terminal window or type the folders' path yourself.
The -r
is to recursively compare any subdirectories found, and the -q
toggles diff into brief mode. Without it, diff, will not only tell you which files are different, but also the actual line-by-line differences for any text files that exist in both locations but are not identical.
On the other hand, Kaleidoscope is a great Application to compare text, images and folders in a very neat and clean way. You can even merge changes with it.