diff(1) on Solnix vs Linux and the BSDs
On Solnix, diff is the illumos diff at /usr/bin/diff, which takes only short options and documents no -N, -p, -x, -X, -I or -a; Linux, FreeBSD, OpenBSD and NetBSD all document these. It adds -h, a fast mode for short, well-separated changes, which no other page lists.
The manual pages
- Solnix: diff(1) from
pkgs.solnix.illumos-world-man; the default on Solnix · illumos.org - Solnix: diff(1) from
pkgs.solnix.diffutils; add the package to get it - Linux: diff(1) diffutils-3.12
- FreeBSD: diff(1) 15.1-RELEASE
- OpenBSD: diff(1) 8.0
- NetBSD: diff(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
diff
What Solnix runs
A default Solnix system runs the illumos diff at /usr/bin/diff; no other illumos variants are shipped. diffutils diff(1) is available from pkgs.solnix.diffutils; it is not on PATH by default. Add that package for the diffutils options.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux | diffutils diff as an add-on | The diff from pkgs.solnix.diffutils has the same options as Linux diffutils diff, including the long options, -N, -p, -y, -x, -X, -I, -a, -B, -Z and --color: it is the same program. Only the illumos diff is on PATH by default.Source: Solnix diff(1) from pkgs.solnix.diffutils OPTIONS; Linux diff(1) OPTIONS |
| all four | recursive diff of added or removed files | Solnix diff has -r, -s, -S and -l for directories, but no -N (treat absent files as empty) or -x/-X exclude options, which all four counterparts document, and no -P, which FreeBSD and OpenBSD list.Source: illumos diff(1) SYNOPSIS, directory options; Linux diff(1) -N, -x, -X; FreeBSD diff(1) SYNOPSIS; OpenBSD diff(1) -N, -P, -x, -X; NetBSD diff(1) -N, -x, -X |
| all four | -p (C function names) | Solnix diff has no -p or -F. On Linux, OpenBSD and NetBSD, -p shows which C function each change is in; FreeBSD lists -p and -F in its synopsis.Source: illumos diff(1) SYNOPSIS; Linux diff(1) -p, -F; OpenBSD diff(1) -p; NetBSD diff(1) -p, -F; FreeBSD diff(1) SYNOPSIS |
| Linux, FreeBSD, NetBSD | -y side-by-side | Solnix and OpenBSD diff have no -y. Linux, FreeBSD and NetBSD diff have -y/--side-by-side. The Solnix page lists sdiff(1) in SEE ALSO.Source: illumos diff(1) SYNOPSIS, SEE ALSO; Linux diff(1) -y; FreeBSD diff(1) -y; NetBSD diff(1) -y |
| all four | -h | Solnix -h does a fast, half-hearted job that works only when changes are short and well separated; it excludes -c, -C, -D, -e, -f and -n and does not descend into directories. No other page lists -h.Source: illumos diff(1) -h; Linux diff(1) DESCRIPTION; FreeBSD diff(1) SYNOPSIS; OpenBSD diff(1) SYNOPSIS; NetBSD diff(1) DESCRIPTION |
| Linux, NetBSD | -f | Solnix -f produces an edit script in the opposite order that ed(1) cannot use. FreeBSD and OpenBSD -f does the same. The Linux and NetBSD pages list no -f.Source: illumos diff(1) -f; FreeBSD diff(1) -f; OpenBSD diff(1) -f; Linux diff(1) OPTIONS; NetBSD diff(1) OPTIONS |
| Linux, NetBSD | context and unified syntax | Solnix takes -C number and -U number with a mandatory argument and has no long forms; -c and -u always give three lines. Linux and NetBSD also accept --context[=NUM] and --unified[=NUM], where the count is optional.Source: illumos diff(1) -c, -C number, -u, -U number; Linux diff(1) -c, -C NUM, --context[=NUM]; NetBSD diff(1) -u, -U NUM, --unified[=NUM] |
| FreeBSD, OpenBSD | context diff markers | In -c output Solnix separates changes with a dozen asterisks and marks removed lines with '--'. FreeBSD and OpenBSD use fifteen asterisks and '- ' for removed lines. Tools that parse context diffs may need to handle both.Source: illumos diff(1) -c; FreeBSD diff(1) -c; OpenBSD diff(1) -c |
| all four | -I and -a | Solnix diff has no -I (ignore lines matching a pattern) or -a (treat files as text). Linux, FreeBSD, OpenBSD and NetBSD all list both.Source: illumos diff(1) SYNOPSIS; Linux diff(1) -I, -a; FreeBSD diff(1) SYNOPSIS; OpenBSD diff(1) -I, -a; NetBSD diff(1) -I, -a |
| Linux, FreeBSD | colour and long options | Solnix diff documents short options only. Linux diff has --color[=WHEN] and --palette, and FreeBSD has --color=when. Use the pkgs.solnix.diffutils diff for colour.Source: illumos diff(1) SYNOPSIS; Linux diff(1) --color, --palette; FreeBSD diff(1) SYNOPSIS (--color=when) |
| Linux | exit status on error | Solnix diff exits 0 for no differences, 1 for differences and any value above 1 for an error. Linux diff documents 2 for trouble. Test for status greater than 1, not equal to 2. Source: illumos diff(1) EXIT STATUS; Linux diff(1) DESCRIPTION (exit status) |
| all four | -L and --label | Solnix diff has no option to set the file labels in a header. FreeBSD and OpenBSD take -L label, FreeBSD also --label, and Linux and NetBSD take --label.Source: illumos diff(1) SYNOPSIS; FreeBSD diff(1) SYNOPSIS; OpenBSD diff(1) -L; Linux diff(1) --label; NetBSD diff(1) --label |
Everyday tasks
| Task | Solnix | Linux | FreeBSD | OpenBSD | NetBSD |
|---|---|---|---|---|---|
| show a unified diff of two files | diff -u file1 file2 | diff -u file1 file2 | diff -u file1 file2 | diff -u file1 file2 | diff -u file1 file2 |
| show a context diff of two files | diff -c file1 file2 | diff -c file1 file2 | diff -c file1 file2 | diff -c file1 file2 | diff -c file1 file2 |
| report only whether two files differ | diff -q file1 file2 | diff -q file1 file2 | diff -q file1 file2 | — | diff -q file1 file2 |
| compare two directories recursively | diff -r directory1 directory2 | diff -r directory1 directory2 | — | — | diff -r directory1 directory2 |
| compare files ignoring letter case | diff -i file1 file2 | diff -i file1 file2 | diff -i file1 file2 | — | diff -i file1 file2 |
| compare files ignoring all white space | diff -w file1 file2 | diff -w file1 file2 | — | — | diff -w file1 file2 |
Standards
- POSIX: diff is a POSIX.1-2024 utility.
- Solnix: INTERFACE STABILITY: the command line interface of diff is Committed, and the output of diff is Committed.
Writing portable scripts
- Use only diff
-u(or-c),-r,-b,-i,-wand-q, which the Solnix page documents. Avoid-N,-p,-y,-x,-X,-I,-a,-Land--label, which/usr/bin/diffdoes not document. - Test the exit status as 0 (same), 1 (different) or greater than 1 (error). Solnix documents 'greater than 1', while Linux documents 2.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.