• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to install korn shell ksh in Linux

August 12, 2013 by Sharad Chhetri 6 Comments

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

Reference:

root@ubuntu:~# which ksh
/usr/bin/ksh
root@ubuntu:~# whereis ksh
ksh: /bin/ksh /usr/bin/ksh /usr/share/ksh /usr/share/man/man1/ksh.1.gz
root@ubuntu:~# 

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

root@ubuntu:~# cat /etc/shells 
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/tmux
/usr/bin/screen
/bin/ksh93
root@ubuntu:~# 

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

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Convert hyphen to underscore in between all filenames shell script
  2. Temporarily change the shell after login
  3. shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
  4. How to customize nologin shell message
  5. Learn Vagrant provision with shell provisioner examples
  6. Recover Linux Grub Password in linux rescue mode CentOS/Red Hat
  7. How to add/install Ubuntu fonts in CentOS/Red Hat Linux
  8. How to upgrade Linux Mint 15 to Linux Mint 16
  9. How to find swap partition or file in linux
  10. How to zip directory in linux explained with examples

Filed Under: Linux, Tips And Tricks Tagged With: ksh, shell

Reader Interactions

Comments

  1. Ahmed says

    January 7, 2018 at 8:29 pm

    The correct command for changing a shell in Ubuntu/Debian is

    chsh -s /bin/ksh username
    Example:

    chsh -s /bin/ksh Nathalie

    Reply
  2. Nathalie says

    August 18, 2017 at 4:54 am

    Hi, I ran the command

    chmod -s /bin/ksh username

    but an error turned up.

    chmod: cannot access ‘username’: No such file or directory.

    What to do? T.T Thanks

    Reply
    • Sharad Chhetri says

      August 23, 2017 at 4:07 pm

      Hi Nathalie,

      You have to replace the username with actual user name which exist in system.
      For eg.

      chmod -s /bin/ksh nathalie
      

      Regards
      Sharad

      Reply
  3. dibyendu says

    March 24, 2015 at 4:39 pm

    [root@localhost ~]# sudo yum -y install ksh
    Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    Setting up Install Process
    No package ksh available.
    Error: Nothing to do

    Reply
    • sharad chhetri says

      March 25, 2015 at 2:55 am

      Seems you Red Hat OS in system is not subscribed. Register your system to Red Hat Subscription Management.

      Reference : https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/registering-cmd.html

      Regards
      Sharad

      Reply
  4. dibyendu banik says

    March 24, 2015 at 12:25 pm

    yum install ksh — this command is not working in RHEL6

    whenever i am trying to using this command its saying ksh package is not available.please help

    Reply

Leave a Reply Cancel reply

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

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

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Allow only members of Wheel group to use su command on RHEL/CentOS

df command not showing correct free space in linux

fatal error: error writing to /tmp/ccwAjc9Z.s: No space left on device

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

AttributeError: ‘WSGIRequest’ object has no attribute ‘session’ Django python web framework

How to find swap partition or file in linux

How to zip directory in linux explained with examples

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy