English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux cmp command is used to compare whether two files have differences.
If the two files to be compared are exactly the same, this command will not display any information. If there are differences, the default is to indicate the character and line number of the first difference. If no file name is specified or the given file name is "-If the input is 'cmp [', the cmp command will read data from the standard input device.
cmp [-clsv][-i <number of characters>][--help][first file][second file]
Parameters:
To determine whether two files are the same, please enter:
cmp prog.o.bak prog.o
This compares prog.o.bak and prog.o. If the files are the same, no message is displayed. If the files are different, the first different position is displayed; for example:
prog.o.bak prog.o differ: char 4, line 1
If the message 'cmp: EOF on prog.o.bak' is displayed, it means that the first part of prog.o is the same as prog.o.bak, but there are other data in prog.o.