The diff and patch Commands

The diff and patch commands are a pair so we will cover them here together. Because of how they work, we will cover diff first.

When using diff, you will take two files, the original template file and an updated file that produces an output file. This file will contain enough information within it to be able to reconstruct the updated file when only given the patch file and template file. This can be handy if you want to only send out updates to, for example, a book, as you could send the edits instead of sending the entire file and replacing it. For smaller files this may not be a big deal, but for larger files that are of substantial size, and may have multiple people working on them, using diff may be very helpful ...

Get SAMS Teach Yourself Unix in 10 Minutes 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.