Korn shell or ksh is another Unix shell like bash,sh and csh. Korn shell was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. Many Unix based operating system like AIX,BSD etc. they already have ksh preinstalled. The AIX by default uses the ksh.
To install Korn shell in Linux .follow the given below steps
Step 1: Login with superuser or become root. Or directly login as root.
sudo su - or su -
Step 2: Install ksh package
In Debian and Ubuntu
apt-get install ksh
In CentOS or Red Hat
yum install ksh
Step 3: After installation find out the path of ksh
which ksh or whereis ksh
[email protected]:~# which ksh /usr/bin/ksh [email protected]:~# whereis ksh ksh: /bin/ksh /usr/bin/ksh /usr/share/ksh /usr/share/man/man1/ksh.1.gz [email protected]:~#
Step 4 : Check /etc/shells for line called /bin/ksh
Note: If you are seeing line /bin/ksh93 that is also ksh but enhanced ksh.If you want to use enhanced ksh (/bin/ksh93) instead of writing /bin/ksh use /bin/ksh93 in below given steps
cat /etc/shells Reference:- [email protected]:~# cat /etc/shells # /etc/shells: valid login shells /bin/sh /bin/dash /bin/bash /bin/rbash /usr/bin/tmux /usr/bin/screen /bin/ksh93 [email protected]:~#
Step 5: Here /bin/ksh is not there then we will add this line in /etc/shells
echo "/bin/ksh" >> /etc/shells
Step 6: Now create a user,set password and change its default shell as ksh
useradd username passwd username chmod -s /bin/ksh username
Step 7: Now login with newly created user and hit below command to know what is default shell it has.
Command: echo $SHELL
su -l username $ echo $SHELL