www.delorie.com/gnu/docs/diffutils/diff_8.html   search  
 
Buy GNU books!


Comparing and Merging Files

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

1.6 Summarizing Which Files Differ

When you only want to find out whether files are different, and you don't care what the differences are, you can use the summary output format. In this format, instead of showing the differences between the files, diff simply reports whether files differ. The `-q' and `--brief' options select this output format.

This format is especially useful when comparing the contents of two directories. It is also much faster than doing the normal line by line comparisons, because diff can stop analyzing the files as soon as it knows that there are any differences.

You can also get a brief indication of whether two files differ by using cmp. For files that are identical, cmp produces no output. When the files differ, by default, cmp outputs the byte and line number where the first difference occurs. You can use the `-s' option to suppress that information, so that cmp produces no output and reports whether the files differ using only its exit status (see section 12. Invoking cmp).

Unlike diff, cmp cannot compare directories; it can only compare two files.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003