which(1) on Solnix vs Linux and the BSDs
On Solnix, which is the illumos /usr/bin/which. Its synopsis, -a and -s options match FreeBSD which(1). Linux which(1) uses long options and returns a failure count, and OpenBSD which(1) uses different exit values.
The manual pages
What Solnix runs
A default Solnix system runs the illumos which at /usr/bin/which. No other variants are shipped. The page notes that some shells provide a built-in which that is similar or identical, so the shell may run its own version instead.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| OpenBSD, NetBSD | -s option | Solnix which -s prints nothing and returns 0 if all commands are found, 1 if not. The OpenBSD and NetBSD synopses have only -a and no quiet option.Source: Solnix which(1) -s; OpenBSD which(1) SYNOPSIS; NetBSD which(1) SYNOPSIS |
| Linux | -s and long options | Solnix which has only -a and -s. Linux which has no -s. It has --all, --read-alias, --skip-dot, --show-tilde and others, none of which Solnix documents.Source: Solnix which(1) SYNOPSIS; Linux which(1) OPTIONS |
| Linux | exit status | Solnix exits 0 if all operands are found, 1 if one or more are not found or an error occurred, and 2 for invalid options. Linux returns the number of failed arguments, or -1 when no programname is given.Source: Solnix which(1) EXIT STATUS; Linux which(1) RETURN VALUE |
| OpenBSD | exit status 1 and 2 | On OpenBSD, 1 means some names were resolved but not all, and 2 means none were resolved. On Solnix, 1 covers any not-found operand or error, and 2 means invalid options. A script testing for 2 behaves differently. Source: OpenBSD which(1) EXIT STATUS; Solnix which(1) EXIT STATUS |
| FreeBSD, NetBSD | exit status documented | The NetBSD page has no EXIT STATUS section. The FreeBSD page documents only that -s returns 0 or 1. Solnix documents 0, 1 and 2 in general, not only with -s.Source: NetBSD which(1); FreeBSD which(1) -s; Solnix which(1) EXIT STATUS |
| Linux | aliases and shell functions | Linux which can read aliases and shell functions from stdin with -i and --read-functions. The Solnix page documents no alias or function handling, and says only that a shell may have its own built-in which.Source: Linux which(1) --read-alias, --read-functions; Solnix which(1) DESCRIPTION |
| OpenBSD | PATH unset | OpenBSD which uses the system's default search path if PATH is unset or empty. The Solnix page lists PATH as affecting which but does not say what happens when it is unset. Source: OpenBSD which(1) ENVIRONMENT; Solnix which(1) ENVIRONMENT |
| NetBSD | csh aliases | NetBSD which does not expand csh(1) aliases and is shell agnostic. The Solnix page does not mention csh aliases. Source: NetBSD which(1) BUGS; Solnix which(1) DESCRIPTION |
| all four | standards | Solnix which is not a POSIX.1-2024 utility. Its command line interface and output are Committed. No counterpart page claims POSIX conformance. OpenBSD's STANDARDS says only that csh(1) has a built-in which with different syntax. Source: Solnix which(1) INTERFACE STABILITY; OpenBSD which(1) STANDARDS |
Standards
- POSIX: which is not a POSIX.1-2024 utility.
- Solnix: Interface Stability: the command line interface of which is Committed. The output of which is Committed.
- OpenBSD: which also exists as a built-in to csh(1), though with a different syntax.
Writing portable scripts
- Use only
-a, or no options, in portable scripts.-sis missing on Linux, OpenBSD and NetBSD, and Linux has no short option for the other extras. - Test for success or failure (zero or non-zero), not for specific exit values: Linux, OpenBSD and Solnix use different non-zero codes.
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.