From Christoph's Personal Wiki
Jump to: navigation, search

Diffutils are a GNU collection of diff utilities.


compares two files and shows the differences, line by line.
shows the offset and line numbers where two files differ, or cmp can show the characters that differ between the two files.
shows the differences between three files. Diff3 can be used when two people have made independent changes to a common original; diff3 can produce a merged file that contains both persons' changes and warnings about conflicts.
can be used to list diff of two files side by side or merge two files interactively.


  • The easiest way to keep track of your patches to your code is to use diff. E.g.:
diff -urNP foo bar > patchset_20071228.patch
  • You can then commit the patchset like so:
patch -p0 --dry-run < patchset_20071228.patch  # Test first, then really do it:
patch -p0 < patchset_20071228.patch
patch -p0 -R < patchset_20071228.patch  # Apply diff in reverse

See also

External links