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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Change the Default Shell In Linux

by admin

In the following example “” will be used to change the login shell from “bash” to “KornShell” for user “test”.

1. To find out what shell you are using just type “echo $SHELL”.

# echo $SHELL
/bin/bash

2. You can get the list of available shells in the system from /etc/shells file.

# cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh

3. If the required shell is missing, it can be installed using the “yum” command. In our case the ksh (KornShell) is not installed so we are going to install it.

# yum install ksh.x86_64

4. Following is the syntax of chsh command:

# chsh -s /bin/[shell-name] [user-name]

5. It will prompt you to enter the password and changes the default shell for the user. Changing the default shell for user “test”.

# chsh -s /bin/ksh test
Changing shell for test.
Shell changed.

6. You must log out and log back in to see this change.

# echo $SHELL
/bin/ksh

Filed Under: Linux

Some more articles you might also be interested in …

  1. Basic vim commands (cheat sheet)
  2. UNIX / Linux : Examples of bash history command to repeat last commands
  3. Understanding /etc/xinetd.conf file in Linux
  4. CentOS / RHEL 5,6 : How to reinstall GRUB loader from rescue mode
  5. How to remove the multipath device after unmapping the storage LUN from server
  6. hdiutil Command Examples in Mac
  7. CentOS / RHEL : How To Check FC Brocade HBA Firmware
  8. Basic Linux File system tutorial – ext2, ext3, ext4, JFS and XFS
  9. “cannot install the best update candidate for package” – error on running dnf update
  10. How to Run DNS and FTP services in a chroot Jail

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright