The diff command provides several output formats to display differences between files. Here are some common formats:
-
Normal Format: This is the default output format, showing line numbers and the type of change (add, delete, change).
diff file1.txt file2.txt -
Side-by-Side Format: This format displays the differences side by side for easier comparison.
diff -y file1.txt file2.txt -
Unified Format: This format provides a more compact view, showing a few lines of context around the changes. It's commonly used in patches.
diff -u file1.txt file2.txt -
Context Format: Similar to unified, but provides more context lines around the changes.
diff -c file1.txt file2.txt -
Report Format: This format summarizes the differences without showing the actual lines.
diff -q file1.txt file2.txt
You can choose the format that best suits your needs based on how you want to view the differences.
