[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cmp
The cmp
command compares two files, and if they differ,
tells the first byte and line number where they differ or reports
that one file is a prefix of the other. Bytes and
lines are numbered starting with 1. The arguments of cmp
are as follows:
cmp options... from-file [to-file [from-skip [to-skip]]] |
The file name `-' is always the standard input. cmp
also uses the standard input if one file name is omitted. The
from-skip and to-skip operands specify how many bytes to
ignore at the start of each file; they are equivalent to the
`--ignore-initial=from-skip:to-skip' option.
By default, cmp
outputs nothing if the two files have the
same contents. If one file is a prefix of the other, cmp
prints to standard error a message of the following form:
cmp: EOF on shorter-file |
Otherwise, cmp
prints to standard output a message of the
following form:
from-file to-file differ: char byte-number, line line-number |
The message formats can differ outside the POSIX locale. Also, POSIX allows the EOF message to be followed by a blank and some additional information.
An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble.
12.1 Options to cmp
Summary of options to cmp
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cmp
Below is a summary of all of the options that GNU
cmp
accepts. Most options have two equivalent names, one of
which is a single letter preceded by `-', and the other of which
is a long name preceded by `--'. Multiple single letter options
(unless they take an argument) can be combined into a single command
line word: `-bl' is equivalent to `-b -l'.
In the above table, operands that are byte counts are normally decimal, but may be preceded by `0' for octal and `0x' for hexadecimal.
A byte count can be followed by a suffix to specify a multiple of that count; in this case an omitted integer is understood to be 1. A bare size letter, or one followed by `iB', specifies a multiple using powers of 1024. A size letter followed by `B' specifies powers of 1000 instead. For example, `-n 4M' and `-n 4MiB' are equivalent to `-n 4194304', whereas `-n 4MB' is equivalent to `-n 4000000'. This notation is upward compatible with the SI prefixes for decimal multiples and with the IEC 60027-2 prefixes for binary multiples.
The following suffixes are defined. Large sizes like 1Y
may be
rejected by your computer due to limitations of its arithmetic.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |