How to Change Default Shell on Linux with chsh

How to Change Default Shell on Linux with chsh

This guide is about How to Change Default Shell on Linux with chsh. So read this free guide, How to Change Default Shell on Linux with chsh. If you have query related to same article you may contact us.

How to Change Default Shell on Linux with chsh – Guide

On most Linux systems, the default shell is bash, but we can change it to any other shell type zsh, fish, sh, and any other. In this article, we will show how to change this default shell to another shell on Linux systems. To change the user’s shell, we first find the current shell. There are many ways to change any user’s shell on a Linux system. We will see three methods for changing the user’s shell. When creating user accounts with the useradd or adduser utilities, the –shell flag can be used to specify a user’s login shell name that is not specified in the respective configuration files.

A shell is a program that acts as the outermost layer of an operating system, through which you interact with its various programs and services. Most Linux distributions use Bash as their default shell. However, you can choose a different shell for your system if you wish. In this article, we describe how to change a user’s shell on Linux. The shell is a program that accepts and interprets commands; There are several shells like bash, sh, ksh, zsh, fish and many other lesser known shells available on Linux.

How to Change my default shell

  • First find out the shells available on your Linux box, runcat /etc/shells
  • Type chsh and press the Enter key
  • You need to enter the new full shell path. For example, /bin/ksh
  • Log in and out to verify that your shell has changed correctly on Linux operating systems.
  • List your shells on Linux

    Run the following cat command in the /etc/shells file:

    Of course, we can use the grep command/egrep command to find out if a specific shell like zsh or fish is installed or not, run:

  • grep “zsh” /etc/shells
  • grep “fish” /etc/shells
  • Find your current shell name

    Run any of the following commands to find the current shell instance:

    OR

  • printf “My current shell – %sn” “$SHELL”
  • OR

  • grep “^${USER}” /etc/passwd
  • Changing the default shell from bash to ksh

    To change your shell to zsh with chsh, run:

  • type -a zsh ## find the path to ksh ##
  • chsh -s /bin/zsh ## change bash to ksh ##
  • Check it:

  • grep “^${USER}” /etc/passwd
  • Final note

    I hope you like the guide How to Change Default Shell on Linux with chsh. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.

    We will be happy to hear your thoughts

    Leave a reply

    How to Guides, Best Lists, Top 10 and Tech News - Compsmag
    Logo