printenv(1) on Solnix vs Linux and the BSDs

printenv is not in the Solnix base system: install pkgs.solnix.coreutils to get the GNU coreutils printenv, the same program Linux ships. Unlike the BSD versions, it accepts -0/--null and several variable names at once.

What Solnix runs

Not installed by default: add pkgs.solnix.coreutils. The package provides GNU coreutils printenv (the page is dated GNU coreutils 9.7). The illumos variant /usr/ucb/printenv is also shipped, but the bundle does not describe it, so its options and exit status are not compared here.

Differences

Compared withTopicWhat differs
Linuxsame programThe Solnix coreutils page and the Linux page document the same GNU printenv: same description, same -0/--null, --help and --version options. Only the coreutils version in the page footer differs (9.7 on Solnix, coreutils-full-9.11 in the Linux header).
Source: Solnix printenv(1) SYNOPSIS, DESCRIPTION; Linux printenv(1) SYNOPSIS, DESCRIPTION
FreeBSD, OpenBSD, NetBSD-0 / --nullSolnix coreutils printenv -0 ends each output line with NUL instead of newline. The FreeBSD, OpenBSD and NetBSD synopses are just printenv [name], with no options. Output is documented as one name/value pair per line.
Source: Solnix printenv(1) -0, --null; FreeBSD/OpenBSD/NetBSD printenv(1) SYNOPSIS, DESCRIPTION
FreeBSD, OpenBSD, NetBSDseveral variable namesSolnix printenv takes any number of VARIABLE arguments. The BSD synopses take a single optional name, and the BSD pages do not say what happens with more than one.
Source: Solnix printenv(1) SYNOPSIS ([VARIABLE]...); FreeBSD/OpenBSD/NetBSD printenv(1) SYNOPSIS ([name])
OpenBSD, NetBSDexit status for an unset nameOpenBSD and NetBSD document exit status 1 when the given name is not in the environment, else 0. The Solnix page has no EXIT STATUS section, so a script cannot rely on its manual for this.
Source: OpenBSD printenv(1) EXIT STATUS; NetBSD printenv(1) DESCRIPTION; Solnix printenv(1) (no EXIT STATUS section)
FreeBSDexit status wordingFreeBSD documents only exit 0 on success and >0 on error. It does not say what happens when the name is unset. The Solnix page does not document exit status either.
Source: FreeBSD printenv(1) EXIT STATUS; Solnix printenv(1)
FreeBSD, OpenBSD, NetBSDprovenance and standardsSolnix and Linux printenv is GNU coreutils. FreeBSD says its printenv is for compatibility with earlier BSD releases and is not specified by any standards. It adds that echo(1) and env(1) can duplicate it.
Source: FreeBSD printenv(1) STANDARDS; Solnix printenv(1) SEE ALSO
Linux, FreeBSDshell builtinsThe Solnix and Linux pages warn that your shell may have its own printenv that supersedes the program. FreeBSD says some shells provide a similar builtin and points to builtin(1). OpenBSD and NetBSD say nothing about this.
Source: Solnix printenv(1) DESCRIPTION (last paragraph); Linux printenv(1) DESCRIPTION; FreeBSD printenv(1) DESCRIPTION

Standards

  • POSIX: printenv is not a POSIX.1-2024 utility.
  • FreeBSD: The printenv utility is provided for compatibility with earlier BSD and FreeBSD releases and is not specified by any standards.

Writing portable scripts

  • Do not use -0/--null or pass several names to printenv in portable scripts. Use a single name, or env(1), and read the output as newline-separated lines.
  • Do not rely on printenv's exit status for an unset variable. OpenBSD and NetBSD document 1, FreeBSD documents only >0 on error, and the Solnix page is silent. Use a shell test such as ${VAR+set} instead.

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.