sed(1) on Solnix vs Linux and the BSDs

The Solnix sed(1) page documents GNU sed from pkgs.solnix.gsed, but the sed on PATH is the illumos /usr/bin/sed, whose options match the BSD sed (-E, -a, -I, -i, -l, -n, -r). A script written for GNU sed can break on a default system, most visibly over -i, -l, -s, -z and the --long options.

What Solnix runs

A default Solnix system runs the illumos sed at /usr/bin/sed. Its synopsis is sed [-Ealnr] with -e, -f, -I[extension] and -i[extension]. /usr/xpg4/bin/sed and /usr/ucb/sed are also shipped, but the bundle does not describe them. The page published for Solnix is GNU sed (package pkgs.solnix.gsed) and is the same text as the Linux gnused-4.10 page. It is not on PATH by default: add pkgs.solnix.gsed. The bundle does not say what name or path the GNU binary is installed under.

Differences

Compared withTopicWhat differs
Linuxsame program as GNU sedThe Solnix package pkgs.solnix.gsed documents the same GNU sed as Linux gnused-4.10. The synopsis and the option descriptions are identical. This is not what runs as /usr/bin/sed on a default Solnix system.
Source: Solnix sed(1) [gsed] SYNOPSIS and DESCRIPTION; Linux sed(1) SYNOPSIS and DESCRIPTION; header line 'command on PATH is illumos at /usr/bin/sed'
Linuxlong optionsGNU sed has --expression, --file, --quiet, --silent, --in-place, --regexp-extended, --null-data, --separate, --posix, --sandbox, --debug and --follow-symlinks. The illumos sed on PATH documents only single-letter options. A script using any long option fails on the default sed.
Source: Solnix sed(1) [gsed] DESCRIPTION; illumos sed(1) SYNOPSIS and options list
all four-l meaningGNU sed -l N sets the line-wrap length for the l command and takes an argument. illumos, FreeBSD and NetBSD -l takes none and makes output line buffered. OpenBSD has no -l: it reads the COLUMNS environment variable for the l function.
Source: Solnix sed(1) [gsed] -l; illumos sed(1) -l; FreeBSD sed(1) -l; NetBSD sed(1) -l; OpenBSD sed(1) ENVIRONMENT COLUMNS
all four-u availabilityGNU sed (-u, --unbuffered), FreeBSD, OpenBSD and NetBSD document -u. The illumos options list on PATH has no -u. In the illumos text -l is the option for line-buffered output.
Source: illumos sed(1) SYNOPSIS [-Ealnr] and -l; Solnix sed(1) [gsed] -u; FreeBSD sed(1) -u; OpenBSD sed(1) -u; NetBSD sed(1) -u
Linux-i and file independenceillumos -i treats each file independently (line numbers restart, $ is the last line of each file). The GNU page documents -s, --separate for treating files separately and does not say whether -i implies it.
Source: illumos sed(1) -i; Solnix sed(1) [gsed] -i, -s; Linux sed(1) -i, -s
FreeBSD, OpenBSD, NetBSD-I and -i in-place editingillumos, FreeBSD and NetBSD have both -I (one continuous line space across files) and -i (each file separate). OpenBSD documents only -i, which resets hold space, line numbers and ranges between files. GNU sed documents only -i.
Source: illumos sed(1) -I, -i; FreeBSD sed(1) -I, -i; NetBSD sed(1) -I, -i; OpenBSD sed(1) -i; Solnix sed(1) [gsed] -i
FreeBSD-i argument formFreeBSD synopsis writes -i extension (and -I extension) as a separate word, and a zero-length extension means no backup. illumos, OpenBSD, NetBSD and GNU write -i[extension], with the suffix attached. sed -i '' follows the FreeBSD form only.
Source: FreeBSD sed(1) SYNOPSIS, -i; illumos sed(1) SYNOPSIS; OpenBSD sed(1) SYNOPSIS; NetBSD sed(1) SYNOPSIS; Solnix sed(1) [gsed] -i[SUFFIX]
Linux-a for w filesillumos, FreeBSD, OpenBSD and NetBSD document -a, which delays opening w files until a command applies. The GNU page lists no -a.
Source: illumos sed(1) -a; FreeBSD sed(1) -a; OpenBSD sed(1) -a; NetBSD sed(1) -a; Solnix sed(1) [gsed] DESCRIPTION
FreeBSD, OpenBSD, NetBSDGNU-only modes-s, -z, --posix, --sandbox, --debug and --follow-symlinks appear only in the GNU page. illumos, FreeBSD, OpenBSD and NetBSD pages list none of them. NetBSD instead has -g/-G to turn GNU regex extensions on or off.
Source: Solnix sed(1) [gsed] -s, -z, --posix, --sandbox, --debug, --follow-symlinks; NetBSD sed(1) -G, -g
Linux, FreeBSD, NetBSDcommand separatorsOpenBSD documents multiple commands separated by newlines or semicolons. It calls newline separation on the command line non-portable, but portable inside a -f file. The other pages do not say.
Source: OpenBSD sed(1) DESCRIPTION and STANDARDS
FreeBSD-f from standard inputFreeBSD reads commands from standard input when the -f command_file is '-'. The illumos, GNU, OpenBSD and NetBSD pages do not document this.
Source: FreeBSD sed(1) -f; illumos sed(1) -f; OpenBSD sed(1) -f; NetBSD sed(1) -f

Standards

  • POSIX: sed is a POSIX.1-2024 utility.
  • OpenBSD: The sed utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification. The flags [-aEiru] are extensions, as is following b, t or : with a semicolon and another command.
  • Linux: The GNU page says --posix disables all GNU extensions, and that for portability -E (POSIX) should be used rather than -r.

Writing portable scripts

  • Use only -n, -e, -f and -E, which every page in the bundle documents. Avoid -r, -i, -l, -u and the long options, since their meaning or availability differs.
  • For in-place edits, write to a temporary file and move it over the original rather than relying on -i, which differs in suffix syntax and per-file behaviour.

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.