cmp [Command]

Command cmp

cmp – command performs byte comparison of two files.


cmp [options] file1 file2


-l displays the byte number (decimal) and the differing bytes (octal) for each mismatch.
-s only returns the exit code (0 – identical files, 1 – various files, 2 — inaccessible or missing argument).


Command cmp compares file1 and file2. If file1 is replaced by ‘-‘ is used standard input. By default, cmp does not issue any messages if the files coincide if the files differ, prominent position in the line and the line number in which is the first mismatched byte. If one of the files is the beginning of another, then message:

cmp: EOF on_the_file_name_shorter

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.