See all Korn shell (KSH) scripting related FAQ
How do I check ksh version? How do I find out ksh version under UNIX like operating systems?

The original Korn shell version is known as ksh88. It is defaulted on many UNIX-like operating systems, including AIX 4. The ksh93 is an updated version of KSH. There are also modified versions of ksh93, which add new features.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux or Unix terminal
Category Terminal/ssh
OS compatibility BSD Linux macOS Unix
Est. reading time 2 minutes

How to find out KSH (Korn Shell) version

  1. To get the ksh version, open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command:
    $ ksh --version

  2. You can also type echo ${.sh.version} command to print KSH version.
  3. Another option is to use the echo "$KSH_VERSION"] command.
Fig.01: UNIX Check ksh version command ouput

Fig.01: UNIX Check ksh version command ouput

The above outputs indicates that I’m using the official ksh93t+ version. It was released on 2010-03-09. If above command failed try pressing ^V ( control + V ) OR ESC + ^V ( Escape followed by control + V ) to display version of the shell in Emacs mode.

How can I get the version of ksh?

Another option is to type the following strings command along with the grep command/egrep command:
$ strings /bin/ksh | grep Version | tail -2
Here is what I saw my Sun Solaris Unix machine:

@(#)$Id: Version AJM 93u+ 2012-08-01 $

Shell script example to find out if I am using modern version of ksh

The sample script is as follows:

if whence -a whence > /dev/null; then
   echo "Good. You are using modern version of KSH."
  echo "Oh no. You are using an older version of KSH."

Summing up

And that is how you find the KSH version. Knowing the KSH (Korn Shell) version number may help with shell and scripting syntax issues.

See also

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

5 comments… add one
  • Tim Jun 19, 2011 @ 23:29

    What desktop OS were you running when you took the Terminal screenshot?

    • 🛡️ Vivek Gite (Author and Admin) nixCraft Jun 20, 2011 @ 5:48

      Sun (now Oracle) Solaris UNIX Gnome desktop.

      • Tim Jun 22, 2011 @ 0:06

        Thanks. I’ve never used Solaris.

  • Jared Jun 26, 2011 @ 17:57

    There’s yet another method

    use vi cmd mode
    then type followed by ^V

    10:55 > set -o vi
    10:56 > PD KSH v5.2.14 99/07/13.2^C

  • juzz4fun.nash Jan 8, 2014 @ 19:30

    Typing below at command prompt works for me:

    what /bin/ksh
    And it says:

    	$Id: enum (AT&T Research) 2008-01-08 $
    	$Id: type (AT&T Labs Research) 2008-01-08 $
    	$Id: type (AT&T Labs Research) 2008-07-01 $
    	$Id: test (AT&T Research) 2003-03-18 $
    	$Id: break (AT&T Research) 1999-04-07 $
    	$Id: continue (AT&T Research) 1999-04-07 $
    	$Id: alias (AT&T Research) 1999-07-07 $
    	$Id: builtin (AT&T Research) 2010-08-04 $
    	$Id: cd (AT&T Research) 1999-06-05 $
    	$Id: command (AT&T Research) 2003-08-01 $
    	$Id: (AT&T Research) 2000-04-02 $
    	$Id: eval (AT&T Research) 1999-07-07 $
    	$Id: exec (AT&T Research) 1999-07-10 $
    	$Id: exit (AT&T Research) 1999-07-07 $
    	$Id: export (AT&T Research) 1999-07-07 $
    	$Id: getopts (AT&T Research) 2005-01-01 $
    	$Id: bg (AT&T Research) 2000-04-02 $
    	$Id: fg (AT&T Research) 2000-04-02 $
    	$Id: disown (AT&T Research) 2000-04-02 $
    	$Id: jobs (AT&T Research) 2000-04-02 $
    	$Id: hist (AT&T Research) 2000-04-02 $
    	$Id: kill (AT&T Research) 2012-04-13 $
    	$Id: let (AT&T Research) 2000-04-02 $
    	$Id: print (AT&T Research) 2008-11-26 $
    	$Id: printf (AT&T Research) 2009-02-02 $
    	$Id: pwd (AT&T Research) 1999-06-07 $
    	$Id: read (AT&T Research) 2006-12-19 $
    	$Id: readonly (AT&T Research) 2008-06-16 $
    	$Id: return (AT&T Research) 1999-07-07 $
    	$Id: sh (AT&T Research) 93u+ 2012-08-01 $
    	$Id: set (AT&T Research) 1999-09-28 $
    	$Id: shift (AT&T Research) 1999-07-07 $
    	$Id: sleep (AT&T Research) 2009-03-12 $
    	$Id: trap (AT&T Research) 1999-07-17 $
    	$Id: typeset (AT&T Research) 2010-12-08 $
    	$Id: ulimit (AT&T Research) 2003-06-21 $
    	$Id: umask (AT&T Research) 1999-04-07 $
    	$Id: unset (AT&T Research) 1999-07-07 $
    	$Id: unalias (AT&T Research) 1999-07-07 $
    	$Id: wait (AT&T Research) 1999-06-17 $
    	$Id: whence (AT&T Research) 2007-04-24 $
    	$Id: regex (AT&T Research) 2012-05-31 $
    	$Id: basename (AT&T Research) 2010-05-06 $
    	$Id: cat (AT&T Research) 2012-05-31 $
    	$Id: chmod (AT&T Research) 2012-04-20 $
    	$Id: cmp (AT&T Research) 2010-04-11 $
    	$Id: cut (AT&T Research) 2010-08-11 $
    	$Id: dirname (AT&T Research) 2009-01-31 $
    	$Id: getconf (AT&T Research) 2012-06-25 $
    	$Id: head (AT&T Research) 2012-05-31 $
    	$Id: logname (AT&T Research) 1999-04-30 $
    	$Id: mkdir (AT&T Research) 2010-04-08 $
    	$Id: sync (AT&T Research) 2006-10-04 $
    	$Id: uname (AT&T Research) 2007-04-19 $
    	$Id: wc (AT&T Research) 2009-11-28 $
    	$Id: Version AJM 93u+ 2012-08-01 $
    	$Id: libcoshell (AT&T Research) 2012-02-22 $


Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.