O'Reilly logo

Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition by Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 versions like -i and the newer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required