Sign in

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.

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 withTopicWhat differs
Linuxdiffutils diff as an add-onThe 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 fourrecursive diff of added or removed filesSolnix 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-sideSolnix 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-hSolnix -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-fSolnix -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, NetBSDcontext and unified syntaxSolnix 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, OpenBSDcontext diff markersIn -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 -aSolnix 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, FreeBSDcolour and long optionsSolnix 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)
Linuxexit status on errorSolnix 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 --labelSolnix 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

TaskSolnixLinuxFreeBSDOpenBSDNetBSD
show a unified diff of two filesdiff -u file1 file2diff -u file1 file2diff -u file1 file2diff -u file1 file2diff -u file1 file2
show a context diff of two filesdiff -c file1 file2diff -c file1 file2diff -c file1 file2diff -c file1 file2diff -c file1 file2
report only whether two files differdiff -q file1 file2diff -q file1 file2diff -q file1 file2—diff -q file1 file2
compare two directories recursivelydiff -r directory1 directory2diff -r directory1 directory2——diff -r directory1 directory2
compare files ignoring letter casediff -i file1 file2diff -i file1 file2diff -i file1 file2—diff -i file1 file2
compare files ignoring all white spacediff -w file1 file2diff -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, -w and -q, which the Solnix page documents. Avoid -N, -p, -y, -x, -X, -I, -a, -L and --label, which /usr/bin/diff does 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.