Show the difference between two text files (or all files with the same names in two directories).


diff [options] from_file to_file


-a treats all files as text even if they aren’t text files.

-b ignores blank lines and repeated blanks.

-c produces output in a different format.

-d tries to find a smaller set of changes (this makes diff slower).

-e produces a script for the ed editor to convert from_file to to_file.

-f produces output similar to that of -e, but in reverse order.

-i ignores case.

-l passes the output to the pr command to paginate it.

-n works like -f, but counts the number of changed lines.

-r recursively compares files with the same name in all subdirectories.

-s reports when two files are the same.

-t expands tabs to spaces in the output.

-u uses the unified output format.

-v displays the version of diff.

-w ignores spaces and tabs when comparing lines.


The diff command compares from_file with to_file and displays the lines that differ. The output is in a format the patch command can use to convert from_file to to_file.