basename(1b) on Solnix vs Linux and the BSDs
This page documents /usr/ucb/basename, the illumos BSD-compatibility basename, which takes only 'string [suffix]'. The command on PATH at /usr/bin/basename is a different variant that this page does not describe. Linux and FreeBSD add -a and -s for several names, and Linux also adds -z.
The manual pages
- Solnix: basename(1b) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: basename(1) coreutils-full-9.11
- FreeBSD: basename(1) 15.1-RELEASE
- OpenBSD: basename(1) 8.0
- NetBSD: basename(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
basename
What Solnix runs
The page describes /usr/ucb/basename, not the command on PATH. A default Solnix system runs the illumos /usr/bin/basename, and /usr/xpg4/bin/basename is also shipped. The bundle does not include the text for those two, so their options and behaviour are not compared here. The page is published in pkgs.solnix.illumos-world-man.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux, FreeBSD | -a and -s options | The Solnix /usr/ucb/basename synopsis is only 'string [suffix]' and documents no options. Linux and FreeBSD accept -a (treat every argument as a name) and -s suffix. A script using either fails against this page's synopsis.Source: Solnix basename(1b) SYNOPSIS; Linux basename(1) -a, -s; FreeBSD basename(1) SYNOPSIS, -a, -s |
| Linux | -z NUL-terminated output | Linux basename -z ends each output line with NUL. The Solnix basename(1b) page documents no such option.Source: Linux basename(1) -z, --zero; Solnix basename(1b) SYNOPSIS |
| Linux | long options | Linux basename has --multiple, --suffix, --zero, --help and --version. The Solnix basename(1b) page documents no options of any kind.Source: Linux basename(1) OPTIONS; Solnix basename(1b) SYNOPSIS |
| Linux | multiple names | In the two-argument form, Linux basename NAME SUFFIX strips the suffix. Its other form, basename OPTION... NAME..., takes many names. The Solnix page documents one string and one optional suffix only. Source: Linux basename(1) SYNOPSIS; Solnix basename(1b) SYNOPSIS |
| FreeBSD | trailing slashes and identical suffix | FreeBSD basename strips trailing slashes first and does not strip a suffix identical to the remaining characters. The Solnix basename(1b) text says only that it deletes any prefix ending in '/' and the suffix, and does not cover these cases. Source: FreeBSD basename(1) DESCRIPTION; Solnix basename(1b) DESCRIPTION |
| FreeBSD, OpenBSD, NetBSD | missing suffix | FreeBSD, OpenBSD and NetBSD say a suffix that does not exist in the string is ignored. The Solnix basename(1b) page does not say what happens in that case. Source: FreeBSD basename(1) DESCRIPTION; OpenBSD basename(1) DESCRIPTION; NetBSD basename(1) DESCRIPTION; Solnix basename(1b) DESCRIPTION |
| FreeBSD, OpenBSD, NetBSD | exit status | The three BSD pages document exit 0 on success and >0 on error. The Solnix basename(1b) page has no EXIT STATUS section. Source: FreeBSD, OpenBSD and NetBSD basename(1) EXIT STATUS; Solnix basename(1b) |
| FreeBSD, NetBSD | dirname in the same page | FreeBSD and NetBSD document dirname in the basename page. The Solnix basename(1b) page covers basename only. Source: FreeBSD basename(1) SYNOPSIS; NetBSD basename(1) SYNOPSIS; Solnix basename(1b) NAME |
| all four | suffix handling | The Solnix page says the suffix is a string with no special significance attached to any of its characters. The other pages in the bundle do not state this. Source: Solnix basename(1b) DESCRIPTION; Linux, FreeBSD, OpenBSD and NetBSD basename(1) |
Standards
- POSIX: basename is a POSIX.1-2024 utility.
- Solnix: The basename(1b) page has no STANDARDS section and points to attributes(7) in SEE ALSO. The bundle does not show the stability levels.
- FreeBSD: basename and dirname are expected to be IEEE Std 1003.2 (“POSIX.2”) compatible.
- OpenBSD: The basename utility is compliant with the specification.
- NetBSD: basename and dirname conform to IEEE Std 1003.2-1992 (“POSIX.2”).
Writing portable scripts
- Use only the form 'basename string [suffix]' in portable scripts. Do not rely on
-a,-sor-z, which are missing from this page and from OpenBSD and NetBSD. - To handle many names, run basename once per name, for example in a loop, instead of using
-a.
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.