Hoylen's Weblog

Tue, 05 Jan 2010

diff utilities

I've been reading the documentation for the diff command on Unix and have discovered lots of powerful options in it.

The diff command can show the changes side by side. You will need a very wide terminal, but you can still get a good indication of what has changed by setting its output to a narrower terminal width.

diff -y -W 80 file1 file2

Two directories can also be recursively compared:

diff -Naur dir1 dir2

There is also an interactive command called sdiff to merge two files together to create a third file. However, I think it is easier to use emerge mode in emacs.

If you are running Mac OS X, another option is to use the FileMerge application. If you install Xcode, It can be found in the /Developer/Applications/Utilities folder.