pwd(1) on Solnix vs Linux and the BSDs
On Solnix, pwd is the illumos /usr/bin/pwd, which defaults to -P like Linux, OpenBSD and NetBSD. FreeBSD defaults to -L. The page tells you to give -L or -P explicitly for portable use.
The manual pages
- Solnix: pwd(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: pwd(1) coreutils-full-9.11
- FreeBSD: pwd(1) 15.1-RELEASE
- OpenBSD: pwd(1) 8.0
- NetBSD: pwd(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
pwd
What Solnix runs
A default Solnix system runs the illumos pwd at /usr/bin/pwd. No other variants are shipped. The page says the Bourne shell, the Korn shells and most other shells have a built-in pwd, which runs instead of /usr/bin/pwd unless you give an absolute path.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD | default mode | With no option, Solnix pwd acts as -P and prints the physical path. FreeBSD pwd assumes -L, so inside a symlinked directory the two print different results.Source: Solnix pwd(1) DESCRIPTION (no options is -P); FreeBSD pwd(1) DESCRIPTION (-L assumed) |
| Linux, OpenBSD, NetBSD | default mode | The default is -P on Solnix, Linux, OpenBSD and NetBSD, so the standalone commands agree when no option is given.Source: Solnix pwd(1) DESCRIPTION; Linux pwd(1) DESCRIPTION; OpenBSD pwd(1) DESCRIPTION; NetBSD pwd(1) DESCRIPTION |
| Linux | same options, GNU extras | Linux pwd takes -L and -P like Solnix, and also --logical, --physical, --help and --version. The Solnix page documents only -L and -P.Source: Linux pwd(1) SYNOPSIS and options; Solnix pwd(1) SYNOPSIS |
| all four | shell builtins | The Solnix page says sh, ksh, ksh93 and most other shells have a built-in pwd that runs unless you give an absolute path. Linux, FreeBSD, OpenBSD and NetBSD pages also warn that a shell builtin may differ, including in default. Source: Solnix pwd(1) DESCRIPTION; Linux pwd(1) DESCRIPTION; FreeBSD pwd(1) DESCRIPTION; OpenBSD pwd(1) CAVEATS; NetBSD pwd(1) DESCRIPTION |
| OpenBSD | -L fallback to -P | OpenBSD -L prints PWD only if it is absolute, names the current directory and has no . or .. components. Otherwise it acts as -P. The Solnix page lists similar criteria as examples only (it says 'Criteria may include').Source: OpenBSD pwd(1) -L; Solnix pwd(1) -L |
| NetBSD | -L validity check | NetBSD -L accepts PWD if it is absolute, contains neither /./ nor /../ and references the current directory. NetBSD notes that -L relies on unique inode numbers, so on FAT file systems it may miss a wrong PWD. The Solnix page does not mention this.Source: NetBSD pwd(1) -L, BUGS; Solnix pwd(1) -L |
| FreeBSD | PWD must be exported | FreeBSD documents that -L does not work unless the shell exports PWD. The Solnix page does not say this, though its -L relies on the PWD environment variable.Source: FreeBSD pwd(1) BUGS; Solnix pwd(1) ENVIRONMENT VARIABLES |
| FreeBSD, OpenBSD, NetBSD | option overriding | Solnix and OpenBSD say the last of -L and -P wins. The FreeBSD and NetBSD pages do not say how repeated or conflicting options combine.Source: Solnix pwd(1) -L, -P; OpenBSD pwd(1) DESCRIPTION; FreeBSD pwd(1) options; NetBSD pwd(1) options |
| all four | error behaviour | On error, Solnix writes nothing to standard output, writes a diagnostic to standard error and exits non-zero. The other pages say only that the exit status is >0 (Linux gives no exit status section). Source: Solnix pwd(1) EXIT STATUS; FreeBSD pwd(1) EXIT STATUS; OpenBSD pwd(1) EXIT STATUS; NetBSD pwd(1) EXIT STATUS |
Standards
- POSIX: pwd is a POSIX.1-2024 utility.
- Solnix: Interface Stability: Committed. The page says that for portable operation you should always specify
-Lor-P. - FreeBSD: The pwd utility conforms to IEEE Std 1003.1-2001 (“POSIX.1”).
- OpenBSD: Compliant with IEEE Std 1003.1-2008 (“POSIX.1”), except that the standard says the default with no options should be
-L. - NetBSD: Expected to conform to IEEE Std 1003.1 (“POSIX.1”), except that the default is
-Pnot-L.
Writing portable scripts
- Always pass
-Lor-Pexplicitly. The default is-Pon Solnix, Linux, OpenBSD and NetBSD but-Lon FreeBSD. - Use only
-Land-P.--logical,--physical,--helpand--versionare in the Linux page only.
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.