Introduction

The commands in this section operate on the contents of files, usually text files. In most cases they are capable of including, or excluding, patterns, as specified by regular expressions. See the chapter on “Finding Stuff” for more information about regular expressions.

The dash character, “-”, is usually used to specify standard input as one of the input files.

comm Compare 2 sorted files. (This command outputs common lines.)
cmp Compare 2 files, usually binaries.
diff Show the difference between 2 files.
diff3 Show the differences between 3 files.
sdiff Merge 2 files.

Get Linux® Desk Reference, Second Edition 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.