What is UNIX / Linux Korn Shell?

What is UNIX / Linux Korn Shell?

Korn Shell is developed by David Korn at Bell Laboratories

It is upwardly compatible with most Bourne shell features.

It has interactive features like C Shell, but executes faster and has extended inline command editing capability.

The ksh93 version supports associative arrays and built-in floating point arithmetic.

Korn Shell Features

  1. Command history – Yes
  2. Line editing – Yes
  3. File name completion – Yes
  4. Alias command – Yes
  5. Restricted shells – Yes
  6. Job control – Yes

#!/usr/bin/ksh

All shell scripts for the KSH shell start with the first line:

#!/usr/bin/ksh

This is called a shebang, a hashbang, hashpling, or pound bang. The following is a KSH shell script file example:

#!/usr/bin/ksh
echo "Hello World!"

You can find ksh path using which command:
$ which ksh
Sample Output:

/usr/bin/ksh

Shebangs specify absolute paths to system executables; this can cause problems on systems which have non-standard file system layouts. Even when systems have fairly standard paths, it is quite possible for variants of the same operating system to have different locations for the desired interpreter. This can be fixed by making a script portable with #!/usr/bin/env as a shebang:

#!/usr/bin/env ksh
echo "Hello World!"

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig 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 glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep 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
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum