cmp ( 1 ) USER COMMANDScmp ( 1 )


NAME

cmp - compare two files

SYNOPSIS

cmp [ options ] file1 file2 [skip1 [skip2]]

DESCRIPTION

cmp compares two files file1 and file2. cmp writes no output if the files are the same. By default, if the files differ, the byte and line number at which the first difference occurred are written to standard output. Bytes and lines are numbered beginning with 1.

If skip1 or skip2 are specified, or the -i option is specified, initial bytes of the corresponding file are skipped before beginning the compare. The skip values are in bytes or can have a suffix of k for kilobytes or m for megabytes.

If either file1 or files2 is -, cmp uses standard input starting at the current location.

OPTIONS

-c, --print-chars
Writes control characters as a ^ followed by a letter of the alphabet and precede characters that have the high bit set with M- as with cat(1).
-i, --ignore-initial=skip
Sets default skip values for the operands skip1 and skip2 to skip. The default value is 0.
-l, --verbose
Write the decimal byte number and the differing bytes (in octal) for each difference.
-s, --quiet|silent
Write nothing for differing files; return non-zero exit status only.

EXIT STATUS

0
The files or portions compared are identical.
1
The files are different.
>1
An error occurred.

SEE ALSO

comm(1), diff(1), cat(1)

IMPLEMENTATION

version
cmp (AT&T Research) 2004-12-01
author
Glenn Fowler <gsf@research.att.com>
author
David Korn <dgk@research.att.com>
copyright
Copyright © 1992-2008 AT&T Intellectual Property
license
http://www.opensource.org/licenses/cpl1.0.txt