Finding Differences in Files with diff

The diff command compares files line by line and outputs any lines that are not identical. For example:

matthew@seymour:~$ diff file1 file2

This command outputs every line that is different between the two. If file1 and file2 are different versions of a configuration file, say the current and a backup, the output quickly tells you what, if anything, has changed. This can help when a config file is automatically updated during an operating system upgrade or when you make a change that doesn’t work as well as you had planned and then go back a couple of weeks later to change the configuration back.

There are several options you may use when running diff (the original UNIX style ...

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.