Updated: 22 October 2026 · Applies to: FreeBSD, the pkg package manager
KornShell (KSH) is still common on older Unix systems and for scripting, even though most modern Linux systems default to bash. Installing it on FreeBSD is quick.
What you need
- A FreeBSD system.
- Terminal access.
- Root or sudo privileges.
1. Update your package information
sudo pkg update sudo pkg upgrade
2. See which KSH variants are available
pkg search ksh
Common options:
ksh93: AT&T's stable KornShell, a good default choice.ksh: the development version of ksh93.mksh: MirBSD KornShell.oksh: OpenBSD's KornShell.
3. Install it
sudo pkg install ksh
Then start it directly:
ksh
or:
ksh93
4. Confirm it is installed
List every shell registered on the system:
cat /etc/shells
You should see an entry like /usr/local/bin/ksh93 alongside the defaults such as /bin/sh and /bin/csh. Find its exact path with:
which ksh93
or:
whereis ksh93
5. Optional: set it as a user's default shell
sudo chsh -s /usr/local/bin/ksh93 username
Changing the root account's shell is generally not recommended.
See its manual page to learn how to use it day to day:
man ksh93
Once KSH is installed, spend a little time with its manual page and try a few interactive commands before relying on it for real scripts: it shares most of the basics with bash, but has its own differences in areas like arrays, parameter expansion and job control that are worth knowing before you depend on it for anything important.
If you need help with the installation or configuration, contact support or hire our server administration team.