diff(1) on Solnix vs Linux and the BSDs
On a default Solnix system, diff is the illumos /usr/bin/diff, not the GNU diffutils program that the published Solnix page describes. It has no long options and no -N, -p, -a, -B, -I, -x, -X, -y, -L or --color. Scripts written for GNU or BSD diff will fail unless they stick to a small flag set.
The manual pages
What Solnix runs
The published Solnix diff(1) page comes from pkgs.solnix.diffutils (GNU diffutils 3.10), but the command on PATH is the illumos /usr/bin/diff, and no other illumos variants are shipped. The bundle does not say where the diffutils package installs its binary, so run it by full path or check with which. The options below that are marked illumos are the only ones the illumos page documents.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux, NetBSD | same program as the published page | The published Solnix page is GNU diffutils 3.10, and the Linux page is GNU diffutils 3.12. Their option lists are identical. NetBSD documents diffutils 2.8.1 (April 2002), which has no --color, -Z, --no-dereference or --palette. Neither is what runs by default on Solnix.Source: Solnix diff(1) footer (diffutils 3.10); Linux diff(1) footer (diffutils 3.12); NetBSD diff(1) footer (diffutils 2.8.1) |
| all four | illumos option set is small | The illumos diff synopsis lists only -b -i -q -t -w, one of -c -C -D -e -f -h -n -u -U, and for directories -l -r -s -S. It documents no long options and no -a, -B, -E, -I, -N, -p, -x, -X or -y, all of which the other systems list.Source: Solnix default illumos diff(1) SYNOPSIS and OPTIONS; Linux, FreeBSD, OpenBSD, NetBSD diff(1) option lists |
| FreeBSD, OpenBSD, NetBSD | context diff format (-c, -C) | illumos -c output separates changes with a dozen asterisks and marks removed lines with '--'. FreeBSD and OpenBSD use fifteen asterisks and mark removed lines '- ' and added lines '+ '. A tool that parses context diffs may not accept both.Source: Solnix default illumos diff(1) -c; FreeBSD diff(1) -c; OpenBSD diff(1) -c |
| Linux, NetBSD | -f and -h | illumos has -f (an ed-style script in reverse order that ed cannot use) and -h (a fast, half-hearted mode). -h is incompatible with -c, -C, -D, -e, -f and -n, and does not descend into directories. The Linux and NetBSD option lists have neither flag.Source: Solnix default illumos diff(1) -f, -h; Linux diff(1) options; NetBSD diff(1) options |
| Linux, FreeBSD, NetBSD | missing -N and -p | illumos has no -N (treat absent files as empty) and no -p (show the C function). -N is documented on Linux, FreeBSD, OpenBSD and NetBSD. -p is documented on Linux, FreeBSD, OpenBSD and NetBSD. A diff -rNup invocation fails on the illumos diff.Source: Solnix default illumos diff(1) SYNOPSIS; Linux, FreeBSD, OpenBSD, NetBSD diff(1) -N, -p |
| all four | -T and -t | illumos -t expands tabs in output. It has no -T. Linux and NetBSD -T (--initial-tab) prepends a tab so tabs line up. OpenBSD -T prints a tab instead of a space before each line.Source: Solnix default illumos diff(1) -t; Linux diff(1) -T, -t; NetBSD diff(1) -T; OpenBSD diff(1) -T, -t |
| Linux, FreeBSD, NetBSD | labels | -L label is documented on FreeBSD and OpenBSD but not in the Linux, NetBSD or illumos option lists. GNU-style systems use --label LABEL, which FreeBSD also accepts. OpenBSD documents only -L.Source: FreeBSD diff(1) SYNOPSIS (-L label | --label label); OpenBSD diff(1) -L; Linux diff(1) --label; NetBSD diff(1) --label |
| FreeBSD, OpenBSD, NetBSD | side-by-side and colour | illumos has no -y and no --color. -y is documented on Linux, FreeBSD and NetBSD, but not on OpenBSD. --color is documented on Linux and FreeBSD only. The GNU page published on Solnix has both.Source: Solnix default illumos diff(1) SYNOPSIS; Linux diff(1) -y, --color; FreeBSD diff(1) SYNOPSIS; OpenBSD diff(1) SYNOPSIS; NetBSD diff(1) options |
| FreeBSD, OpenBSD | -P and -X/-x semantics | illumos has no -P, -x or -X. OpenBSD -x matches basenames by shell-style glob and -X reads patterns from a file. FreeBSD and OpenBSD -P treats a file found only in dir2 as an empty file in dir1. Linux and NetBSD use --unidirectional-new-file for that.Source: OpenBSD diff(1) -P, -x, -X; FreeBSD diff(1) SYNOPSIS; Linux diff(1) --unidirectional-new-file; Solnix default illumos diff(1) SYNOPSIS |
| Linux | exit status | illumos exits 0 when no differences are found, 1 when differences are found, and above 1 on error. Linux documents 2 for trouble. A script testing for exactly 2 can miss other illumos error codes. Source: Solnix default illumos diff(1) EXIT STATUS; Linux diff(1) DESCRIPTION (exit status 0, 1, 2) |
| all four | -v and -n meaning | illumos has no -v or --version. Linux and NetBSD -v prints the version. illumos -n produces an ed-like script in reverse order with line counts. Linux and NetBSD -n selects RCS format. FreeBSD and OpenBSD describe the same reverse-order form as used by rcsdiff.Source: Solnix default illumos diff(1) -n; Linux diff(1) -v, -n; NetBSD diff(1) -v, -n; FreeBSD diff(1) -n; OpenBSD diff(1) -n |
| all four | environment variables | The illumos page lists LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, LC_TIME, NLSPATH and TZ. TZ sets the timezone for timestamps written by -c and -C. The Linux and NetBSD pages in the bundle list no environment variables. The FreeBSD and OpenBSD texts are trimmed.Source: Solnix default illumos diff(1) ENVIRONMENT VARIABLES; Linux diff(1); NetBSD diff(1) |
Standards
- POSIX: diff is a POSIX.1-2024 utility.
Writing portable scripts
- Stick to
-u,-r,-q,-b,-w,-i,-eand-D, which the illumos, Linux and BSD pages all list. Avoid long options and-N,-p,-a,-B,-I,-L,-y,--color, which the default Solnix diff does not document. - Test the exit status as 0 (same), 1 (different), anything else (error). Do not test for exactly 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.