Compare and Diff two folders under macOS (also Debian / Ubuntu / Linux)

To quickly see which files and directories differ or only exist in one place, we can use the built-in diff tool like so:

diff -rq /path/to/dir_a /path/to/dir_b

It will print out something like this:

Files /path/to/dir_a/.DS_Store and /path/to/dir_a/.DS_Store differ
Only in /path/to/dir_a:
Only in /path/to/dir_b: Other

As for the options:

  • r: do recursive investigation, process subdirectories
  • q: use brief mode, just show the file/directory differences without further detail