O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

cmp

Checks whether two files differ

cmp [options] file1 [file2]

The cmp utility does a byte-by-byte comparison of file1 and file2. If the files differ, cmp outputs the location at which the first difference occurs. Unlike diff (page 1149), cmp works with binary as well as ASCII files.

The cmp utility returns an exit status of 0 if the files are the same and 1 if they are different. An exit status > 2 means that an error occurred.

Arguments

The file1 and file2 arguments identify the two files to compare. If file2 is omitted, cmp uses standard input instead. Using a filename of - for either file1 or file2 causes cmp to read standard input in place of that file.

Options

--ignore-initial=n

-i n Skips the first n bytes in both files before beginning ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required