Reference articles on history, science, culture and more
Encyclopedia

KornShell

Bourne shell backward compatible Unix shell created by David Korn

Image credit is listed at the end of this article.
ksh2020
DevelopersKurtis Rader, Siteshwar Vashisht, community
Final release2020 / October 10, 2019 (2019-10-10)
Predecessor93v-
LicenseEclipse Public License
Websitekornshell.com 
Repositorygithub.com/ksh2020/ksh
ksh93u+m
DevelopersMartijn Dekker, Johnothan King, hyenias
Stable release1.0.10 / August 2, 2024 (2024-08-02)
Predecessor93u+
LicenseEclipse Public License
Websitegithub.com/ksh93/ksh/wiki
Repositorygithub.com/ksh93/ksh

KornShell (ksh) is a Unix shell which was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. The initial development was based on Bourne shell source code. Other early contributors were Bell Labs developers Mike Veach and Pat Sullivan, who wrote the Emacs and vi-style line editing modes' code, respectively. KornShell is backward-compatible with the Bourne shell and includes many features of the C shell, inspired by the requests of Bell Labs users.

01Features

KornShell complies with POSIX.2, Shell and Utilities, Command Interpreter (IEEE Std 1003.2-1992.) Major differences between KornShell and the traditional Bourne shell include:

  • job control, command aliasing, and command history designed after the corresponding C shell features; job control was added to the Bourne Shell in 1989
  • a choice of three command line editing styles based on vi, Emacs, and Gosling Emacs
  • associative arrays and built-in floating-point arithmetic operations (only available in the ksh93 version of KornShell)
  • dynamic search for functions
  • mathematical functions
  • process substitution and process redirection
  • C-language-like expressions
  • enhanced expression-oriented for and while loops
  • dynamic extensibility of (dynamically loaded) built-in commands (since ksh93)
  • reference variables
  • hierarchically nested variables
  • variables can have member functions associated with them
  • object-oriented-programming (since ksh93t)
    • variables can be objects with member (sub-)variables and member methods
    • object methods are called with the object variable name followed (after a dot character) by the method name
    • special object methods are called on: object initialization or assignment, object abandonment (unset)
    • composition and aggregation is available, as well as a form of inheritance
Korn Shell running on Windows Services for UNIX
Korn Shell running on Windows Services for UNIX

02History

KornShell was initially distributed as part of AT&T's Experimental Toolchest, in 1986, and was later included in UNIX System V Release 4, in 1989.

KornShell was originally proprietary software. In 2000 the source code was released under a license particular to AT&T, but since the ksh93q release in early 2005 it has been licensed under the Eclipse Public License. KornShell is available as part of the AT&T Software Technology (AST) Open Source Software Collection. As KornShell was initially only available through a proprietary license from AT&T, a number of free and open source alternatives were created. These include pdksh, mksh, Bash, and Z shell.

The functionality of the original KornShell, ksh88, was used as a basis for the standard POSIX.2, Shell and Utilities, Command Interpreter (IEEE Std 1003.2-1992).

Some vendors still ship their own versions of the older ksh88 variant, sometimes with extensions. ksh93 is maintained on GitHub, originally in att/ast ("AT&T Software Technology"), since moved to ksh93/ksh.

As "Desktop KornShell" (dtksh), ksh93 is distributed as part of the Common Desktop Environment. This version also provides shell-level mappings for Motif widgets. It was intended as a competitor to Tcl/Tk.

The original KornShell, ksh88, became the default shell on AIX in version 4, with ksh93 being available separately.

UnixWare 7 includes both ksh88 and ksh93. The default Korn shell is ksh93, which is supplied as /usr/bin/ksh, and the older version is available as /usr/bin/ksh88. UnixWare also includes dtksh when CDE is installed.

The last active years of att/ast

The ksh93 distribution underwent a less stable fate after the authors left AT&T around 2012, the final release being ksh93u+ 2012-08-01.

The primary authors of ksh continued working on a ksh93v- beta branch as "community members" of the att/ast GitHub repository until around 2014. At the request of its customers, Red Hat took up maintenance of ksh93v- in 2017 in the same AT&T-owned repository and released an initial version of ksh2020 in the fall of 2019. This release contained fixes for many issues and dropped many functions the authors found unnecessary (some having been deprecated before) such as EBCDIC support and broken math functions; accordingly, it was marked a "major release". Unfortunately it also introduced unintended crashes incompatibilities with previously-working scripts.

The changes in ksh2020 proved too sudden for ksh users, which were surprised by the incompatible changes after 26 years of minor maintenance, and to AT&T, which was flooded with bug reports referring to a software version they have never released but was nevertheless in their software repository. In March 2020, AT&T decided to roll back the community changes, stash them in a branch, and restart from ksh93u+: the explanation was that AST (AT&T Software Technology) was intended to only be a repository in maintenance mode, containing all sorts of AT&T code, not the ksh-focused repository Red Hat had turned it into.

Following this decision, att/ast had its "default branch" changed back to one that contained ksh93u+. Between February 2020 and June 2025 (when the repository was archived [made read-only]), a total of 13 commits were written to the repository. The last commit occurred in June 2020.

Successor forks

The ksh2020 code was moved to a repository called ksh2020/ksh, but no further commits were written after February 2020. It was archived in October 2021.

In May 2020, Martijn Dekker (McDutchie) forked att/ast, which contained ksh93u+ 2012-08-01, into ksh93/ksh. The README.md called the new project ksh93u+m and made a commitment to stability (without "bug compatibility"). As of August 2026, the last commit dates to April 2026.

Between 2017 and 2020 there was an ultimately unsuccessful attempt to breathe new life into the KornShell by extensively refactoring the last unstable AST beta version (93v-). While that ksh2020 effort is now abandoned and still has many critical bugs, it also had a lot of bugs fixed. More importantly, the AST issue tracker now contains a lot of documentation on how to fix those bugs, which made it possible to backport many of them to the last stable release instead. This ksh 93u+m reboot now incorporates many of these bugfixes, plus patches from OpenSUSE, Red Hat, and Solaris, as well as many new fixes from the community. Though there are many bugs left to fix, we are confident at this point that 93u+m is already the least buggy version of ksh93 ever released. As of late 2021, distributions such as Debian and Slackware have begun to package it as their default version of ksh93.

, Martijn Dekker, "README: Why?", ksh93/ksh (2021)

03Primary contributions to the main software branch

For the purposes of the lists below, the main software branch of KSH is defined as the original program, dating from July 1983, up and through the release of KSH2020 in late 2019. Continuing development of follow-on versions (branches) of KSH have split into different groups starting in 2020 and are not elaborated on below.

Primary individual contributors

The following are listed in a roughly ascending chronological order of their contributions:

  • David G. Korn (AT&T Bell Laboratories, AT&T Laboratories, and Google; and creator)
  • Glenn S. Fowler (AT&T Bell Laboratories, AT&T Laboratories)
  • Kiem-Phong Vo (AT&T Bell Laboratories, AT&T Laboratories)
  • Adam Edgar (AT&T Bell Laboratories)
  • Michael T. Veach (AT&T Bell Laboratories)
  • Patrick D. Sullivan (AT&T Bell Laboratories)
  • Matthijs N. Melchior (AT&T Network Systems International)
  • Karsten-Fleischer (Omnium Software Engineering)
  • Boyer-Moore
  • Siteshwar Vashisht (Red Hat)
  • Kurtis Rader

Integration consultant

  • Roland Mainz

Primary corporate contributors

The following are listed in a roughly ascending chronological order of their contributions:

Donated corporate resources

Besides the primary major contributing corporations (listed above), some companies have contributed free resources to the development of KSH. These are listed below (alphabetically ordered):

04Variants

There are a few forks of KornShell:

  • dtksh , a fork of ksh93 included as part of CDE.
  • tksh , a fork of ksh93 that provides access to the Tk widget toolkit.
  • KornShell is included in UWIN, a Unix compatibility package by David Korn.

There are many clones of KornShell:

  • The initial attempt at cloning was Ron Natalie's fork of the SVR2 Bourne shell that had both job control and command line editing. This was a contemporary of the original ksh at a time when it had not escaped AT&T. This was integrated as the /bin/sh in Doug Gwyn's (US Army BRL) "System V on BSD", and was subsequently the /bin/sh that shipped with all the CMU Mach-derived systems.
  • pdksh , Public Domain Korn Shell, a classic ksh clone derived from the Charles Forsyth's public domain V7 shell, which in turn derived from the BRL shell. Used as the standard shell for OpenBSD under the name ksh.
    • oksh , a port of OpenBSD's variant of KornShell, intended to be maximally portable across operating systems. It was used as the default shell in DeLi Linux 7.2.
    • loksh , a Linux port of OpenBSD's variant of KornShell, with minimal changes.
    • mksh , a free implementation of the KornShell language, forked from OpenBSD pdksh. It was originally developed for MirOS BSD and is licensed under permissive (though not public domain) terms; specifically, the MirOS Licence. In addition to its usage on BSD, this variant has replaced pdksh on Debian, and is the default shell on Android.
  • SKsh , an AmigaOS clone that provides several Amiga-specific features, such as ARexx interoperability. In this tradition MorphOS uses pdksh in its SDK.
  • MKS Inc.'s MKS Korn shell , a proprietary implementation of the KornShell language from Microsoft Windows Services for UNIX (SFU) up to version 2.0; according to David Korn, the MKS Korn shell was not fully compatible with KornShell in 1998. In SFU version 3.0 Microsoft replaced the MKS Korn shell with a new POSIX.2-compliant shell as part of Interix.

The language extensions pioneered by ksh have also been adopted into other Bourne-compatible shells:

  • Zsh includes an emulate ksh mode.
  • Bash includes almost all ksh88 features such as [[ ... ]], but does not claim to be ksh-compatible. In addition, ksh93 has a bash compatibility mode, but it is known to be broken.
Watch videos about KornShellExplainers and documentaries on YouTube (opens in a new tab)

Sources and credits

This article is adapted from the Wikipedia article KornShell, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.

Images, from Wikimedia Commons:

Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.