File Comparison

diff

Line-by-line comparison of two files or directories.

comm

Line-by-line comparison of two sorted files.

cmp

Byte-by-byte comparison of two files.

md5

Compute a checksum of the given files.

There are three ways to compare files:

  • Line by line (diff, comm), best suited to text files

  • Byte by byte (cmp), often used for binary files

  • By comparing checksums (md5)

These programs are all text-based. For a graphical file-comparison tool, try xxdiff at http://furius.ca/xxdiff.

Get Macintosh Terminal Pocket 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.