diff Command Generator
Generate diff commands to compare files line by line
Getting Started with diff
## What is diff?
`diff` compares two files (or directories) line by line and prints the lines that differ. It's the foundation of patches, code reviews, and merge conflict resolution.
## How to Use
1. **Specify Files**: Enter the two files to compare (file1 and file2). 2. **Set Options** (optional): `-u` for unified format, `-q` for a quick yes/no, `-r` to recurse directories. 3. **Copy & Run**: Copy the generated command into your terminal.
Output Formats
### `-u` Unified format The default for patches and most code tools. Shows a few lines of context around each change with `+` / `-` markers for added / removed lines.
### `-q` Brief Print only whether the two files differ (no details). Great for scripted checks.
### `-r` Recursive When comparing two directories, descend into matching subdirectories.
### `-i` / `-w` Ignore differences `-i` ignores case; `-w` ignores all whitespace. Useful when only content matters.
### Exit code `diff` exits `0` if files match, `1` if they differ, and `2` on error — handy in shell scripts:
``` if ! diff -q old.txt new.txt > /dev/null; then echo "changed"; fi ```
▶Which output format should I use?
▶How do I ignore whitespace-only changes?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee