Comparing two text files on a unix system Comparing two text files on a unix system unix unix

Comparing two text files on a unix system


In emacs, if you pull both files into different buffers, you can use the M-x ediff-buffers command to display the differences. Emacs will nicely highlight the differences and allow you to scroll through the buffers concurrently. See tip #5 on this "Ten Essential Emacs tips" page, or the GNU docs on Ediff.

Under Unix there's the diff command. Here's a short example of using diff, and one more example

I usually prefer comparing with Emacs, more visual, though of course both files will need to fit into buffers.