How To Install Korn Shell in Ubuntu?


A Unix shell is a program that interprets the command or script and acts as an intermediary between user and kernel of the system. Bash, zsh, csh, and fish are some examples of Unix shells. Bash is a default shell for most of the Linux distributions.

Like other shells ksh (Korn Shell) is also a Unix shell available for almost all Linux or Unix users. It was developed by David Korn in Bell Labs in the early 1980s.

Ahead in this article, we will see about the installation and use of ksh in Ubuntu and its aligned distributions.

Korn Shell vs Bash

The major difference between ksh and bash are –

  • Korn shell has associative arrays and bash doesn’t also it has built-in floating-point operations.
  • Bash handles getting exit codes from pipes in a cleaner way.
  • Korn shell has the print command which is way better than the echo command.
  • Korn shell has the r history command that allows quickly to re-run older commands.
  • Bash is much easier to set a prompt that displays the current directory.
  • Korn shell has three command-line editing styles based on vi, emac, and gosling emac.

How to install the Korn shell?

To install Korn shell in Debian/Ubuntu and their derivative, First, open the terminal by pressing ctrl+alt+t. And then use the following command –

sudo apt-get ksh

Press y if it asks for confirmation –

Now ksh installation is complete. Your system has multiple shells installed. If you want to make ksh as your default shell then find the path where it is installed.

Locating ksh

To find the location where ksh is installed execute the following command in your terminal –

whereis ksh

Now you can see in the above image /usr/bin/ksh is the location of ksh.

Using ksh

For using ksh temporarily, you can access it from bash by using the following command –

ksh

Korn shell also uses a $(dollar) symbol as the default prompt.

if you want to exit from the ksh use the following command –

exit

Make Ksh as your default shell

To make ksh as your default shell execute the following command in your terminal-

chsh -s /usr/bin/ksh

The root user can make it default for a particular user by using the following command –

chsh -s /usr/bin/ksh user_name

Now if you want to make bash as your default shell again then run the following command in your terminal-

chsh -s /bin/bash

Conclusion

In this article, you learn about Korn shell, its installation, and making it your default shell. I hope this is useful to you. If you have a query or suggestion regarding the topic you can write to us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.