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.

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 withTopicWhat differs
Linux, FreeBSD-a and -s optionsThe 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 outputLinux 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
Linuxlong optionsLinux 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
Linuxmultiple namesIn 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
FreeBSDtrailing slashes and identical suffixFreeBSD 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, NetBSDmissing suffixFreeBSD, 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, NetBSDexit statusThe 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, NetBSDdirname in the same pageFreeBSD 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 foursuffix handlingThe 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, -s or -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.