Sign in

sed(1) on Solnix vs Linux and the BSDs

On Solnix, sed is the illumos sed at /usr/bin/sed, a BSD-style sed with -a, -E, -I/-i, -l and -r and no GNU long options. Its -l means line-buffered output, while GNU sed's -l N sets the wrap length for the l command.

What Solnix runs

/usr/bin/sed is the illumos sed. /usr/xpg4/bin/sed and /usr/ucb/sed are also shipped. pkgs.solnix.gnused and pkgs.solnix.gsed also publish a sed(1) page and are not on PATH by default. The pkgs.solnix.gnused page is a stub that names GNU sed and points to its Texinfo manual.

Differences

Compared withTopicWhat differs
Linux-l meaningSolnix sed -l makes output line buffered and takes no argument. GNU sed -l N sets the line-wrap length for the l command, so sed -l 72 means different things on the two.
Source: illumos sed(1) -l; Linux sed(1) -l N, --line-length
Linuxlong options and GNU-only flagsSolnix /usr/bin/sed lists no long options. It has none of GNU's --expression, --in-place, --posix, --debug, --sandbox, --follow-symlinks or --version, and no -s, -z or -V.
Source: illumos sed(1) SYNOPSIS; Linux sed(1) SYNOPSIS, DESCRIPTION (-s, -z, --posix, --sandbox, --follow-symlinks)
all four-u unbufferedSolnix sed documents no -u. GNU sed -u loads minimal input and flushes output more often. FreeBSD and NetBSD -u make output unbuffered. OpenBSD -u forces line-buffered output. On Solnix the closest documented option is -l (line buffered).
Source: illumos sed(1) SYNOPSIS, -l; Linux sed(1) -u; FreeBSD sed(1) -u; NetBSD sed(1) -u; OpenBSD sed(1) -u
Linux-i and separate filesSolnix -i makes each file independent. The Linux page lists -s, --separate as a separate option and does not say that -i implies it. Scripts that rely on per-file line numbers should pass -s on GNU sed.
Source: illumos sed(1) -i; Linux sed(1) -i[SUFFIX], -s, --separate
FreeBSDin-place extension argumentFreeBSD documents -i extension and -I extension with the extension as a separate argument, and a zero-length extension means no backup. Solnix takes the extension attached, as -i.bak, and saves a backup only if an extension is given.
Source: FreeBSD sed(1) SYNOPSIS, -I, -i; illumos sed(1) SYNOPSIS, -I[extension], -i[extension]
NetBSDGNU regex extensions flagNetBSD has -g to turn on GNU regex extensions and -G to turn them off (the default). Solnix sed has neither flag.
Source: NetBSD sed(1) -G, -g; illumos sed(1) SYNOPSIS, -E
Linux-a optionSolnix -a delays creating or truncating the files named by w functions until a command writes to them. The GNU sed page documents no -a.
Source: illumos sed(1) -a; Linux sed(1) DESCRIPTION (options)
FreeBSDreading commands from stdin with -f -FreeBSD reads commands from standard input when -f is given - as the file. The Solnix -f text does not say this.
Source: FreeBSD sed(1) -f; illumos sed(1) -f
OpenBSDno -I or -l on OpenBSDOpenBSD sed has -i[extension] but no -I and no -l. Solnix documents -I (one line space across all files) and -l (line-buffered output).
Source: OpenBSD sed(1) SYNOPSIS; illumos sed(1) -I, -l

Everyday tasks

TaskSolnixLinuxFreeBSDOpenBSDNetBSD
apply an editing command to a filesed -e command filesed -e script filesed -e command filesed -e command filesed -e command file
run editing commands from a script filesed -f command_file filesed -f script-file filesed -f command_file filesed -f command_file filesed -f command_file file
print only the lines a command selectssed -n command filesed -n script file—sed -n command file—
edit a file in place, with no backupsed -i command filesed -i script filesed -i '' -e command filesed -i command file—
use extended regular expressionssed -E command filesed -E script file—sed -E command file—
make output line bufferedsed -l command file——sed -u command file—

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 to that specification.
  • OpenBSD: Following the b, t, or : commands with a semicolon and another command is an extension. Using newlines to separate commands on the command line is non-portable, but is portable inside a -f command file.

Writing portable scripts

  • For portable scripts use only -n, -e, -f and -E, and put multiple commands in a -f file, one per line.
  • Avoid -i, -I, -l and -u. They differ in syntax or meaning across Solnix, GNU sed and the BSDs. To edit a file, write sed output to a temporary file and move it into place.

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.