Next: , Previous: , Up: Command-line commands   [Contents][Index]

17.4.14 cmp

Command: cmp [-v] file1 file2

Compare the file file1 with the file file2. If they are completely identical, $? will be set to 0. Otherwise, if the files are not identical, $? will be set to a nonzero value.

By default nothing will be output. If the -v is used, verbose mode is enabled. In this mode when when the files differ in size, print the sizes like this:

Differ in size: 0x1234 [foo], 0x4321 [bar]

If the sizes are equal but the bytes at an offset differ, then print the bytes like this:

Differ at the offset 777: 0xbe [foo], 0xef [bar]