printenv(1b) on Solnix vs Linux and the BSDs

On Solnix, printenv(1b) is the illumos BSD-compatibility command at /usr/ucb/printenv. It takes at most one variable name and has no options. The main difference for Linux users is that GNU printenv accepts several names plus -0/--null, which Solnix does not document.

What Solnix runs

A default Solnix system runs the illumos printenv at /usr/ucb/printenv, the only variant shipped. It is in the BSD-compatibility directory /usr/ucb, so it is only found if that directory is on PATH. The Solnix page documents no options and no exit status.

Differences

Compared withTopicWhat differs
Linuxmultiple variable namesLinux printenv accepts any number of VARIABLE arguments. The Solnix synopsis takes a single optional variable, so a script that passes several names cannot rely on it.
Source: Linux printenv(1) SYNOPSIS [VARIABLE]...; Solnix printenv(1b) SYNOPSIS [variable]
Linux-0 / --nullLinux printenv -0 or --null ends each output line with NUL instead of newline. The Solnix page lists no options, so it documents no NUL-terminated output.
Source: Linux printenv(1) -0, --null; Solnix printenv(1b) SYNOPSIS
Linux--help and --versionLinux printenv has --help and --version. The Solnix page documents no options at all.
Source: Linux printenv(1) --help, --version; Solnix printenv(1b) SYNOPSIS
Linuxoutput with a name givenThe Linux page says that with a name or names it prints their values. Solnix prints only the value of the one variable named. The Linux page does not say whether names are printed with the values.
Source: Linux printenv(1) DESCRIPTION; Solnix printenv(1b) DESCRIPTION
OpenBSD, NetBSDexit status for an unset variableOpenBSD and NetBSD printenv exit 1 when the named variable is not in the environment, and 0 otherwise. The Solnix page documents no exit status.
Source: OpenBSD printenv(1) EXIT STATUS; NetBSD printenv(1) DESCRIPTION; Solnix printenv(1b)
FreeBSDexit statusFreeBSD documents exit 0 on success and >0 on error, with no mention of an unset variable. The Solnix page has no exit status section.
Source: FreeBSD printenv(1) EXIT STATUS; Solnix printenv(1b)
FreeBSD, OpenBSD, NetBSDoutput format wordingThe BSD pages say output is one name/value pair per line. The Solnix page says only that it prints the values of the variables in the environment, without stating a line format.
Source: FreeBSD, OpenBSD and NetBSD printenv(1) DESCRIPTION; Solnix printenv(1b) DESCRIPTION
FreeBSDshell builtin noteThe FreeBSD page says some shells provide a builtin printenv. The Linux page says a shell's own printenv usually supersedes the described one. The Solnix page does not mention builtins.
Source: FreeBSD printenv(1) DESCRIPTION; Linux printenv(1) DESCRIPTION; Solnix printenv(1b)

Standards

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

Writing portable scripts

  • Call printenv with at most one name and no options. Only that form is documented on Solnix and all the BSDs.
  • Do not test the exit status for an unset variable. OpenBSD and NetBSD document 1, but the Solnix and FreeBSD pages do not. Use the shell's own ${VAR+x} test 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.