The diff command
compare files line by line 8 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.
Options in the examples
-u, -U NUM, --unified[=NUM]- output NUM (default 3) lines of unified context
-b, --ignore-space-change- ignore changes in the amount of white space
-i, --ignore-case- ignore case differences in file contents
-q, --brief- report only when files differ
-r, --recursive- recursively compare any subdirectories found
-w, --ignore-all-space- ignore all white space
Examples
diff ~/compare/app.conf ~/compare/app.conf.new
diff -u ~/compare/app.conf ~/compare/app.conf.new
diff -u ~/compare/app.conf ~/compare/app.conf.new > ~/compare/changes.diff
diff -q ~/compare/app.conf ~/compare/app.conf.newFiles ... differ
diff -r ~/compare/site-v1 ~/compare/site-v2
diff -i a.txt b.txtupper/lower case
diff -w a.txt b.txtspaces and tabs
diff -b a.txt b.txta different amount of spaces