cmp Linux Command Cheatsheet

1680




cmp Linux command is used to compare 2 files byte by byte. It reports the byte, line number where the first difference is found.
If no difference, no output will return. The optional SKIP1 and SKIP2 specify the number of bytes to skip at the beginning of each file (zero if nothing specified).

Syntax

cmp [OPTION]... FILE1 [FILE2 [SKIP1 [SKIP2]]]

Basic Command syntax

cmp [OPTION]... FILE1 FILE2

Example

$ cmp file1.txt file2.txt
file1.txt file2.txt differ: char 2, line 1