sdiff(1) on Solnix vs Linux and the BSDs

On a default Solnix system, sdiff is the illumos /usr/bin/sdiff, which accepts only -l, -s, -o and -w. The published Solnix page is the GNU diffutils sdiff (pkgs.solnix.diffutils), which matches Linux and has many more options. A script using -i, -b, -W, -t or long options fails on the default command.

What Solnix runs

The published sdiff(1) page comes from pkgs.solnix.diffutils (GNU diffutils 3.10), but the command on PATH is the illumos /usr/bin/sdiff. No other illumos variants are shipped. The illumos synopsis is sdiff [-l] [-s] [-o output] [-w n] filename1 filename2. The GNU options (-i, -b, -W, -Z, -E, -B, -I, -a, -t, -d, -H, --strip-trailing-cr, --tabsize, --diff-program and the long forms) are documented only on the GNU page. The bundle does not say where the diffutils package installs its sdiff, so check which sdiff your PATH resolves.

Differences

Compared withTopicWhat differs
Linuxsame program as the published pageThe published Solnix page is GNU diffutils sdiff 3.10, and Linux documents GNU diffutils 3.12 with an identical option list. The default Solnix /usr/bin/sdiff is a different, smaller illumos program.
Source: Solnix sdiff(1) (diffutils 3.10) OPTIONS; Linux sdiff(1) (diffutils 3.12) OPTIONS; illumos sdiff(1) SYNOPSIS
all fouroptions missing from default illumos sdiffThe illumos sdiff has only -l, -s, -o and -w. It lacks -a, -b, -d, -i, -I, -t and -W, which Linux, FreeBSD, OpenBSD and NetBSD all document. It also has no long options. Scripts passing those flags fail unless the diffutils sdiff is the one run.
Source: illumos sdiff(1) SYNOPSIS, OPTIONS; Linux sdiff(1) OPTIONS; FreeBSD/OpenBSD/NetBSD sdiff(1) SYNOPSIS
all four-W and -w-w sets the output width on every system. -W means ignore all white space on the GNU page and on all three BSDs. The illumos sdiff has no -W, so use the diffutils sdiff for it.
Source: Solnix sdiff(1) -w, -W; illumos sdiff(1) -w; FreeBSD sdiff(1) -w, -W; OpenBSD sdiff(1) -W; NetBSD sdiff(1) -W
all fourinteractive command set differsThe illumos -o prompt is %, with commands l, r, s, v, e, e l, e r, e b and q. FreeBSD and OpenBSD also accept 1 and 2 for l and r. OpenBSD adds b l, b r, b 1 and b 2 to choose both sets. The GNU page does not list the commands.
Source: illumos sdiff(1) -o; FreeBSD sdiff(1) -o; OpenBSD sdiff(1) -o; NetBSD sdiff(1) -o; Solnix sdiff(1) -o
FreeBSD, OpenBSD, NetBSDeditor and TMPDIR environmentFreeBSD, OpenBSD and NetBSD document EDITOR and VISUAL for -o (VISUAL wins, default vi) and TMPDIR (default /tmp). The illumos page says only that it calls the editor and lists only LANG and LC_* variables. The GNU page documents no environment variables.
Source: FreeBSD/OpenBSD/NetBSD sdiff(1) ENVIRONMENT; illumos sdiff(1) ENVIRONMENT VARIABLES, -o; Solnix sdiff(1)
Linux, OpenBSDexit statusThe GNU page gives 0 for the same, 1 for different and 2 for trouble. OpenBSD gives 0, 1, and >1 for an error. The illumos, FreeBSD and NetBSD pages in the bundle document no exit statuses.
Source: Solnix sdiff(1) last paragraph of DESCRIPTION; Linux sdiff(1) same; OpenBSD sdiff(1) EXIT STATUS; illumos, FreeBSD, NetBSD sdiff(1) (no section)
OpenBSD, NetBSDGNU-only options in synopsisOpenBSD and NetBSD synopses list only -a -b -d -i -l -s -t -W, -I, -o and -w. -B, -E, -H, -Z and --diff-program appear in the GNU options. Both BSD pages say undocumented GNU long options may work, and that some need GNU diff.
Source: OpenBSD sdiff(1) SYNOPSIS, CAVEATS; NetBSD sdiff(1) SYNOPSIS, CAVEATS; Solnix sdiff(1) OPTIONS
FreeBSDFreeBSD vs GNU option setFreeBSD adds --ignore-file-name-case and --no-ignore-file-name-case, which GNU does not list. It lacks the GNU -Z (--ignore-trailing-space) and --diff-program. Its --strip-trailing-cr is described as 'Skip identical lines', whereas GNU describes stripping a trailing carriage return.
Source: FreeBSD sdiff(1) options passed to diff(1); Solnix sdiff(1) -Z, --diff-program, --strip-trailing-cr
FreeBSD, OpenBSD, NetBSD-b descriptionGNU -b ignores changes in the amount of white space. The three BSD pages describe -b as 'Ignore trailing blank spaces'. The GNU -Z is the option that ignores white space at line end.
Source: Solnix sdiff(1) -b, -Z; FreeBSD/OpenBSD/NetBSD sdiff(1) -b
FreeBSD, OpenBSD, NetBSDreading standard inputThe GNU page says a FILE of '-' reads standard input. The BSD pages and the illumos page do not document this.
Source: Solnix sdiff(1) last paragraph of DESCRIPTION; FreeBSD/OpenBSD/NetBSD sdiff(1) DESCRIPTION; illumos sdiff(1) DESCRIPTION
FreeBSD, OpenBSD, NetBSDbinary dataOpenBSD and NetBSD list under BUGS that sdiff may not work with binary data. The GNU page offers -a to treat all files as text and does not make that warning.
Source: OpenBSD sdiff(1) BUGS; NetBSD sdiff(1) BUGS; Solnix sdiff(1) -a

Standards

  • POSIX: sdiff is not a POSIX.1-2024 utility.
  • Solnix: The illumos page lists ATTRIBUTE TYPE CSI with value Enabled, and refers to largefile(7) for files of 2 Gbyte (2^31 bytes) or more.
  • OpenBSD: The sdiff command first appeared in AT&T System III UNIX and was reimplemented for OpenBSD 3.9.

Writing portable scripts

  • For portable use, stick to -l, -s, -o and -w width: these are the only options that the illumos sdiff and all other pages in the bundle share.
  • Avoid -W, -b, -i and -t unless you know the diffutils sdiff is the one running, because the default Solnix sdiff lacks them. Only test exit status 0 versus non-zero; 2 is documented only by GNU, and >1 only by OpenBSD.

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.