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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. df: command not found
  2. “git show-refs” Command Examples
  3. lzop Command Examples
  4. ledger Command Examples
  5. RPM command examples to query, install, remove and upgrade packages
  6. filefrag: command not found
  7. gh config: Change configuration for GitHub cli
  8. d8: Developer shell for the V8 JavaScript engine
  9. How to Check CentOS Version
  10. mate-search-tool: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright