[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11. Invoking cmp

The cmp command compares two files, and if they differ, tells the first byte and line number where they differ. Its arguments are as follows:

 
cmp options... from-file [to-file [skip1 [skip2]]]

The file name `-' is always the standard input. cmp also uses the standard input if one file name is omitted.

skip1 and skip2 are the number of bytes to skip in each file. They are equivalent to skip1:skip2 in the --ignore-initial option. skip values may be followed by the following multiplicative suffixes: kB 1000, K 1024, MB 1,000,000, M 1,048,576, GB 1,000,000,000, G 1,073,741,824, and so on for T, P, E, Z, Y.

An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble.

11.1 Options to cmp  Summary of options to cmp.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.1 Options to 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'.

`-b'
`--print-bytes'
Print the differing characters. Display control characters as a `^' followed by a letter of the alphabet and precede characters that have the high bit set with `M-' (which stands for "meta").

`--help'
Output help.

`-i skip'
`--ignore-initial=skip'
Ignore any differences in the the first skip bytes of the input files. Treat files with fewer than skip bytes as if they are empty.

`-i skip1:skip2'
`--ignore-initial=skip1:skip2'
Ignore any differences in the the first skip1 bytes of the file1 and the first skip2 bytes of file2.

`-l'
`--verbose'
Print the (decimal) byte numbers and (octal) values of all differing bytes.

`-n'
`--bytes=limit'
Compare at most limit bytes.

`-s'
`--quiet'
`--silent'
Do not print anything; only return an exit status indicating whether the files differ.

`-v'
`--version'
Output the version number of cmp.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Santiago Vila on January, 24 2005 using texi2html