Spring Into Linux

Compares two files to see whether they are the same. This command is used to compare binary files. To compare text files, use the diff command.

Format: cmp file1 file2 Examples: cmp prog1 prog2

The output depends on the options used.

Opt

What It Does

Example

-c

Display differing bytes as characters

cmp -c file1 file2

-l

Display location of differing bytes

cmp -l file1 file3

-s

Display nothing; return exit codes:

0=identical; 1=different; 2=inaccessible

cmp -s file77 prog3

    Категории