How To: Find Out KSH ( Korn Shell ) Version on Linux or Unix-like system

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 default on many UNIX like operating system including AIX 4. The ksh93 is an updated version. There are also modified versions of ksh93 which add new features. To get ksh version open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command:

ksh --version

OR

echo ${.sh.version}

OR

echo $KSH_VERSION

OR

Sample outputs:

Fig.01: UNIX Check ksh version command ouput

The above version 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 command:

strings /bin/ksh | grep Version | tail -2

Sample outputs:

@(#)$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:

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

More links and information:

  1. KSH 93 man page
  2. KSH 88 man page
  3. Visit home Page for the KornShell to download latest ksh93 version for Linux / UNIX / Apple OS X / BSD operating systems.
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • Tim Jun 19, 2011 @ 23:29

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

    • 🐧 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:

    bin/ksh
    	$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 $
    

    regards,
    juzz4fun

Leave a Reply

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

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.