1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

Ubuntu

Documentation

By

diff and patch

The diff program can be used to compare two files and to make patches. A typical example might be diff -ruN file.old file.new > file.diff. This command will create a diff (recursively if directories are used) that shows the changes, or "delta", between the two files.

The patch program is used to apply a patch (usually created by diff or another similar program) to a file or directory. To apply the patch created above, we can invoke patch -p0 < file.diff. The -p tells patch how much it should strip from the paths for the file names in the patch. -p0 means to strip nothing, or leave the path intact.


* License

* Ubuntu Packaging Guide Index

  1. About.com
  2. Technology
  3. Linux
  4. Linux Distributions
  5. Popular Linux Distros
  6. Ubuntu
  7. Ubuntu Packaging Guide
  8. Ubuntu Packaging Guide - diff and patch

©2014 About.com. All rights reserved.