Finding differences in files with diff

In addition to using cmp to find out how files differ, you can also use diff. This command tells you specifically where two files differ, not just that they differ and at which point the differences start (see Code Listing 6.15).

Finding differences with diff:

  • diff dearliza dearhenry
    Type diff, followed by both file names. The diff output, as in Code Listing 6.15, shows lines that appear only in one file or the other. The lines from file 1 are indicated with a <, while the lines from file 2 are indicated with >. Above each line is its line number in the first file, then d, a, or c, then the corresponding line number from the second file:
    • d means that the line would have to be deleted from file 1 to make ...

Get Unix: Visual QuickStart Guide 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.