diffutils: Comparison

1 
1 1 What Comparison Means
1 ***********************
1 
1 There are several ways to think about the differences between two files.
1 One way to think of the differences is as a series of lines that were
1 deleted from, inserted in, or changed in one file to produce the other
1 file.  'diff' compares two files line by line, finds groups of lines
1 that differ, and reports each group of differing lines.  It can report
1 the differing lines in several formats, which have different purposes.
1 
1    GNU 'diff' can show whether files are different without detailing the
1 differences.  It also provides ways to suppress certain kinds of
1 differences that are not important to you.  Most commonly, such
1 differences are changes in the amount of white space between words or
1 lines.  'diff' also provides ways to suppress differences in alphabetic
1 case or in lines that match a regular expression that you provide.
1 These options can accumulate; for example, you can ignore changes in
1 both white space and alphabetic case.
1 
1    Another way to think of the differences between two files is as a
1 sequence of pairs of bytes that can be either identical or different.
1 'cmp' reports the differences between two files byte by byte, instead of
1 line by line.  As a result, it is often more useful than 'diff' for
1 comparing binary files.  For text files, 'cmp' is useful mainly when you
1 want to know only whether two files are identical, or whether one file
1 is a prefix of the other.
1 
1    To illustrate the effect that considering changes byte by byte can
1 have compared with considering them line by line, think of what happens
1 if a single newline character is added to the beginning of a file.  If
1 that file is then compared with an otherwise identical file that lacks
1 the newline at the beginning, 'diff' will report that a blank line has
1 been added to the file, while 'cmp' will report that almost every byte
1 of the two files differs.
1 
1    'diff3' normally compares three input files line by line, finds
1 groups of lines that differ, and reports each group of differing lines.
1 Its output is designed to make it easy to inspect two different sets of
1 changes to the same file.
1 
1    These commands compare input files without necessarily reading them.
1 For example, if 'diff' is asked simply to report whether two files
1 differ, and it discovers that the files have different sizes, it need
1 not read them to do its job.
1 

Menu