readlink(1) on Solnix vs Linux and the BSDs
readlink is not in the Solnix base system: install pkgs.solnix.coreutils to get GNU coreutils readlink. It is the same program as Linux readlink, with -e, -m, -z and long options that the BSD pages do not document.
The manual pages
- Solnix: readlink(1) from
pkgs.solnix.coreutils - Linux: readlink(1) coreutils-full-9.11
- FreeBSD: readlink(1) 15.1-RELEASE
- OpenBSD: readlink(1) 8.0
- NetBSD: readlink(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
readlink
What Solnix runs
Not installed by default: add pkgs.solnix.coreutils. The published page is GNU coreutils 9.7, and no other illumos variants are shipped. The page itself says realpath(1) is a better command for canonicalization.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux | same program | Solnix and Linux both document GNU coreutils readlink with the same synopsis and option set (-f, -e, -m, -n, -q, -s, -v, -z, --help, --version). The Solnix page is from coreutils 9.7 and the Linux page from coreutils-full 9.11.Source: Solnix readlink(1) SYNOPSIS and DESCRIPTION; Linux readlink(1) SYNOPSIS and DESCRIPTION |
| Linux | POSIXLY_CORRECT and -s/-v defaults | The Linux page says -s is on by default if POSIXLY_CORRECT is not set, and -v is on by default if it is set. The Solnix page says only that -s is on by default and does not mention POSIXLY_CORRECT.Source: Linux readlink(1) -s, -v; Solnix readlink(1) -s, -v |
| all four | not in base system | A default Solnix system has no readlink on PATH. Install pkgs.solnix.coreutils before running scripts that call it. Source: Solnix bundle header (command on PATH: none: install pkgs.solnix.coreutils) |
| FreeBSD, OpenBSD, NetBSD | -e and -m | Solnix readlink has -e (all components must exist) and -m (no requirement that components exist). The FreeBSD, OpenBSD and NetBSD pages document only -f for canonicalization.Source: Solnix readlink(1) -e, -m; FreeBSD readlink(1) SYNOPSIS; OpenBSD readlink(1) -f; NetBSD readlink(1) -f |
| FreeBSD, OpenBSD, NetBSD | -f existence rule | Solnix -f requires every component except the last to exist. The BSD pages say -f follows every symlink in every component and returns an absolute path, and they state no such existence rule. NetBSD adds only that it returns the absolute path 'if possible'.Source: Solnix readlink(1) -f; FreeBSD readlink(1) DESCRIPTION; OpenBSD readlink(1) -f; NetBSD readlink(1) DESCRIPTION |
| FreeBSD, OpenBSD, NetBSD | -z and long options | Solnix has -z, which ends each output line with NUL, and long options such as --canonicalize and --no-newline. The BSD pages document neither. With -z, -n omits the trailing NUL instead of a newline.Source: Solnix readlink(1) -z, -n, --canonicalize; FreeBSD, OpenBSD and NetBSD readlink(1) OPTIONS |
| OpenBSD | number of arguments | Solnix takes one or more files (readlink [OPTION]... FILE...). The OpenBSD synopsis is readlink [-fn] file, a single file. NetBSD documents file ...; FreeBSD documents [file ...].Source: Solnix readlink(1) SYNOPSIS; OpenBSD readlink(1) SYNOPSIS; NetBSD readlink(1) SYNOPSIS; FreeBSD readlink(1) SYNOPSIS |
| OpenBSD | -q, -s, -v | Solnix accepts -q, -s and -v. The OpenBSD page documents only -f and -n, so a script using the other three options is not covered there.Source: Solnix readlink(1) -q, -s, -v; OpenBSD readlink(1) SYNOPSIS and OPTIONS |
| NetBSD | quiet mode and POSIXLY_CORRECT | NetBSD -q is the default and -v turns quiet off. Setting POSIXLY_CORRECT makes -v the default. Solnix documents -s as on by default and does not describe any POSIXLY_CORRECT effect.Source: NetBSD readlink(1) -q, -s, -v, ENVIRONMENT; Solnix readlink(1) -s, -v |
| FreeBSD | readlink is part of stat(1) | On FreeBSD the page is stat(1), and readlink is stat invoked under another name. Its readlink synopsis is [-fn]. The page says error messages are suppressed automatically when run as readlink. The other stat options are not part of that synopsis.Source: FreeBSD readlink(1) NAME, SYNOPSIS, -q |
| FreeBSD, OpenBSD, NetBSD | exit status documentation | The Solnix page has no EXIT STATUS section. OpenBSD documents 0 on success and >0 on error. NetBSD documents exit 1 for a usage error, a missing file, or a non-symlink without -f; otherwise 0.Source: Solnix readlink(1) (no EXIT STATUS section); OpenBSD readlink(1) EXIT STATUS; NetBSD readlink(1) EXIT STATUS |
Standards
- POSIX: readlink is a POSIX.1-2024 utility.
- NetBSD: readlink is expected to conform to, provided it is run with POSIXLY_CORRECT set in its environment.
- Solnix: The Solnix page has no STANDARDS section.
Writing portable scripts
- Use only readlink
-fand-n, with one file per call.-e,-m,-z,-q,-s,-vand long options are missing from the OpenBSD page, and from the FreeBSD readlink synopsis where noted above. - Check the exit status instead of relying on error messages. The
-q/-s/-v defaults are documented differently on Solnix, Linux and NetBSD.
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.