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

The Solnix page test(1b) documents /usr/ucb/test, the BSD-compatibility variant. A default Solnix system runs the illumos /usr/bin/test, which this page does not describe. The biggest difference is -f: with /usr/ucb ahead of /usr/bin in PATH it means 'not a directory', not 'regular file'.

What Solnix runs

The command on PATH is the illumos /usr/bin/test. /usr/xpg4/bin/test and /usr/ucb/test are also shipped. This page's SYNOPSIS shows only /usr/ucb/test, so the bundle does not describe /usr/bin/test or /usr/xpg4/bin/test. The page says that /usr/bin/sh users who put /usr/ucb before /usr/bin in PATH get the ucb -f behaviour, which is also the default for /usr/bin/csh users. Check which test you are running before relying on -f.

Differences

Compared withTopicWhat differs
all four-f meaningSolnix test -f is true for a regular file. If /usr/ucb precedes /usr/bin in PATH (sh users), or by default for csh users, it is true for any existing non-directory. Linux and the BSDs document -f only as 'regular file'.
Source: Solnix test(1b) USAGE -f, NOTES (not-a-directory transition aid for BSD applications); Linux/FreeBSD/OpenBSD/NetBSD test(1) -f
all fourprimaries missing from the pageThe Solnix page lists no -e, -h, -L, -O, -G, -S, -nt, -ot or -ef. All four counterparts document these, except that Linux has no -e or -N counterpart listed on Solnix. Do not use them in scripts that may hit /usr/ucb/test.
Source: Solnix test(1b) USAGE Primitives; Linux/FreeBSD/OpenBSD/NetBSD test(1) primaries lists
all fourstring ordering < and >The Solnix page documents only = and != for strings. Linux compares with < and > in the current locale. FreeBSD compares by binary character value, and OpenBSD and NetBSD by ASCII value.
Source: Solnix test(1b) USAGE; Linux test(1) STRING1 > STRING2; FreeBSD test(1) s1 < s2; OpenBSD test(1) s1 < s2; NetBSD test(1) s1 < s2
all fourexit status for falseSolnix says only that a non-zero status is set for false or for no arguments. FreeBSD, OpenBSD and NetBSD give 1 for false or a missing expression and >1 for an error. The Linux page does not give numeric codes.
Source: Solnix test(1b) DESCRIPTION; FreeBSD/OpenBSD/NetBSD test(1) EXIT STATUS; Linux test(1) DESCRIPTION
all fourowner permission quirk for -r, -w, -xOn Solnix, if you own the file but the tested permission lacks the owner bit, the result is false even when the group or other bit is set. Super-user gets the correct status. The counterpart pages do not describe this.
Source: Solnix test(1b) NOTES; Linux/FreeBSD/OpenBSD/NetBSD test(1) -r, -w, -x
all fouroperator precedence and extra argumentsOn Solnix, = and != bind tighter than -r through -n and cannot be combined with them. After -r through -n only the first argument is examined, unless the second argument is -a or -o. The other pages do not document this.
Source: Solnix test(1b) NOTES; counterpart test(1) DESCRIPTION
Linux, OpenBSD, NetBSD-a and -o statusSolnix documents -a and -o without warning. Linux calls them ambiguous. OpenBSD marks them obsolete XSI. NetBSD says not to use them and to chain test with && and ||. FreeBSD BUGS says both sides are always evaluated.
Source: Solnix test(1b) Operators; Linux test(1) DESCRIPTION; OpenBSD test(1) STANDARDS; NetBSD test(1) CAVEATS; FreeBSD test(1) BUGS
all fourbracket form and -t defaultThe Solnix SYNOPSIS shows only /usr/ucb/test expression, though DESCRIPTION refers to a second bracket line. Counterparts show [ expression ]. Solnix -t defaults to descriptor 1, and the counterpart pages state no default.
Source: Solnix test(1b) SYNOPSIS, DESCRIPTION, USAGE -t; counterpart test(1) SYNOPSIS and -t
Linux--help, --version, -l and -NLinux '[' honors --help and --version, and 'test' treats them as strings. Linux also has INTEGER as -l STRING (string length) and -N (modified since last read). The Solnix page documents none of these.
Source: Linux test(1) DESCRIPTION; Solnix test(1b) USAGE
FreeBSD== operatorFreeBSD accepts == as a substitute for =. The Solnix page documents only =. The Linux, OpenBSD and NetBSD pages do not list ==.
Source: FreeBSD test(1) COMPATIBILITY; Solnix test(1b) USAGE

Standards

  • POSIX: test is a POSIX.1-2024 utility.
  • Solnix: The test(1b) page has no STANDARDS section and states no interface stability. It lists attributes(7) under SEE ALSO.
  • FreeBSD: test implements a superset of the IEEE Std 1003.2 (“POSIX.2”) specification. The primaries <, ==, >, -ef, -nt, -ot, -G, and -O are extensions.
  • OpenBSD: test is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification. The primaries -G, -k, -O, -nt, -ot, -ef, <, and > are extensions. The operators -a, -o, and () are marked by POSIX.1 as part of X/Open System Interfaces and obsolete.
  • NetBSD: test implements a superset of the IEEE Std 1003.2 (“POSIX.2”) specification.

Writing portable scripts

  • Use only -b -c -d -f -g -k -p -r -s -t -u -w -x -z -n, =, != and -eq/-ne/-gt/-ge/-lt/-le. Test -e, -L, -nt and similar through a shell builtin, or avoid them. Solnix test(1b) does not list them.
  • Do not rely on -f to exclude directories. Under /usr/ucb/test it is true for any non-directory.
  • Combine tests with [ a ] && [ b ] instead of -a and -o, and quote parentheses.

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.