English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

La commande cmp de Linux

大全 command Linux

La commande cmp de Linux est utilisée pour comparer les différences entre deux fichiers.

If the two files compared are exactly the same, the 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 specified file name is "-If " is specified, the cmp command will read data from the standard input device.

syntax

cmp [-clsv][-i <number of characters>][--help][first file][second file]

parameter:

  • -c or--print-chars In addition to displaying the decimal code of the marked difference, display the corresponding character of the character.
  • -i<number of characters> or--ignore-initial=<number of characters> Specify a number.
  • -l or--verbose Indicate all differences.
  • -s or--quiet or--silent Do not display error information.
  • -v or--version Display version information.
  • --help Online help.

example online

To determine whether two files are the same, 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, the first part of prog.o is the same as prog.o.bak, but there is other data in prog.o.

大全 command Linux