cd(1) on Solnix vs Linux and the BSDs
On Solnix, cd(1) documents the shell built-ins (sh, csh, ksh) and also ships a standalone /usr/bin/cd that cannot change your shell's directory and only tests whether a directory could be entered. FreeBSD's cd(1) page is an index of shell built-ins, and NetBSD's says cd is always a shell built-in.
The manual pages
- Solnix: cd(1) from
pkgs.solnix.illumos-world-man· illumos.org - FreeBSD: cd(1) 15.1-RELEASE
- NetBSD: cd(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
cd
What Solnix runs
A default Solnix system runs the illumos /usr/bin/cd, which changes directory only inside its own process and so has no effect on the calling shell. /usr/xpg4/bin/cd is also shipped, but the bundle does not describe how it differs. The cd you normally type is the built-in of your shell: sh, csh or ksh/ksh93. The Solnix page documents each separately.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD, NetBSD | standalone /usr/bin/cd | Solnix ships /usr/bin/cd, which affects only its own process and exists to test whether a directory can be made current. NetBSD says cd is always a shell regular built-in and does not describe a standalone utility.Source: Solnix cd(1) DESCRIPTION /usr/bin/cd; NetBSD cd(1) DESCRIPTION |
| FreeBSD | standalone form on FreeBSD | FreeBSD's table marks cd as 'No*' for standalone: an external file exists, but it is a script that uses the shell built-in of the same name. Solnix describes /usr/bin/cd as a separate utility with its own synopsis.Source: FreeBSD cd(1) (builtin index) Commands table and the 'No*' note; Solnix cd(1) SYNOPSIS |
| FreeBSD, NetBSD | what the page documents | The Solnix page has separate sections for sh, csh and ksh/ksh93 built-ins. The FreeBSD page only lists which of csh(1) and sh(1) provide cd and defers details to the shell manual. The NetBSD page covers only `cd [directory]` and refers to the shell's manual. Source: Solnix cd(1) SYNOPSIS, DESCRIPTION; FreeBSD cd(1) SYNOPSIS, DESCRIPTION; NetBSD cd(1) DESCRIPTION |
| FreeBSD, NetBSD | -L, -P and `cd old new` (ksh) | The Solnix ksh/ksh93 cd takes -L and -P to handle dot-dot logically or physically, and has a second form `cd old new` that substitutes a string in PWD. The FreeBSD and NetBSD pages document no options and no second form for cd.Source: Solnix cd(1) ksh, ksh93 (-L, -P, second form); NetBSD cd(1) SYNOPSIS; FreeBSD cd(1) SYNOPSIS |
| NetBSD | CDPATH result printed | NetBSD prints the new working directory to standard output when it was found through CDPATH. The Solnix page does not say this for /usr/bin/cd, sh, csh or ksh.Source: NetBSD cd(1) ENVIRONMENT CDPATH; Solnix cd(1) ENVIRONMENT VARIABLES CDPATH |
| NetBSD | OLDPWD support | On Solnix, OLDPWD is the previous directory used by `cd -`, and the ksh text says it is set whenever PWD changes. NetBSD sets OLDPWD after a directory change but says csh(1) does not support it. The Solnix sh and csh text does not mention OLDPWD. Source: Solnix cd(1) ENVIRONMENT VARIABLES OLDPWD, ksh, ksh93; NetBSD cd(1) ENVIRONMENT OLDPWD |
| FreeBSD, NetBSD | directory stack commands | Solnix documents csh pushd, popd and dirs (with dirs -l for an unabbreviated listing) on the cd page. FreeBSD lists them as csh-only, not in sh. The NetBSD cd page does not cover them.Source: Solnix cd(1) csh; FreeBSD cd(1) (builtin index) Commands table (pushd, popd, dirs); NetBSD cd(1) SYNOPSIS |
| NetBSD | HOME with no argument | Solnix sh, csh and ksh use HOME as the default directory. NetBSD changes to HOME only if it exists and contains a directory name. The Solnix text does not describe the case where HOME is unset or empty. Source: Solnix cd(1) sh, csh, ksh DESCRIPTION; NetBSD cd(1) ENVIRONMENT HOME |
| FreeBSD, NetBSD | rksh | On Solnix, the restricted Korn shell rksh cannot execute cd. Neither the FreeBSD nor the NetBSD text mentions restricted shells. Source: Solnix cd(1) ksh, ksh93 (last paragraph); NetBSD cd(1); FreeBSD cd(1) |
Standards
- POSIX: cd is a POSIX.1-2024 utility.
- Solnix: Interface Stability is Committed for csh, ksh and sh.
- NetBSD: The cd command is expected to be IEEE Std 1003.2 (“POSIX.2”) compatible.
- FreeBSD: The FreeBSD page in the bundle states no standard for cd.
Writing portable scripts
- Use cd only as a shell built-in, with a single directory operand. Do not rely on
/usr/bin/cdor an external cd to change your script's directory. - Avoid cd
-L, cd-P, `cd old new`, and OLDPWD in csh. The bundle documents them only for Solnix ksh, and NetBSD says csh does not support OLDPWD.
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.