cmp linux command compares two files and tells you which line numbers are different in linux os.
$cmp [option] [file_name1] [file_name2]
Sr.No |
Options |
Descriptions |
---|---|---|
01 |
-c |
output differing bytes as characters. |
02 |
-l |
print the byte number(decimal) and the differing byte values(octal) for each difference. |
03 |
-s |
prints nothing for differing files,return exit status only |
Returning Values
Sr.No |
Options |
Descriptions |
---|---|---|
01 |
0 |
file are identical |
02 |
1 |
file differ |
03 |
2 |
inaccessible or missing argument |
Example
$cmp file1.txt file2.txt