Change the Default Shell Easily in the Terminal

Change Your Default User Shell Easily

There are a number of shells available to use for a user in the Linux Terminal. The most widely used one is obviously Bash or ‘sh’ which is also the default for most of the users. And the other popular ones are Zsh, Ksh, Fish, etc. However, the switching process between these shells is not possible just by installing a new shell and removing the other one.

In this article, we will take a look at the process through which we can change the default shell of the Terminal in any Linux distribution. There are two main methods through which we can achieve this.

Also read: ZSH4Humans – Easily change your shell to ZSH

List out the available shells

Open a Terminal and type the following command:

cat /etc/shells
List Out All The Shells
List Out All The Shells

This gives you the available shells which are installed on your system. Make sure that both the shells, the current one and the shell which you are shifting to, are mentioned in the command’s output. I have both ZSH and Bash installed and for this demonstration, I will switch to ZSH from Bash.

Method 1 – Usermod utility

Using the usermod utility, one can change the user’s account details which are stored in the /etc/passwd file, and using the -s or –shell flag, we can change the default shell of any user. For example, in my case, the user aadesh has the following shell and we will change it to zsh using the following commands :

grep aadesh /etc/passwd
sudo usermod -s /bin/zsh aadesh
grep aadesh /etc/passwd
Changing Shell To Zsh With Usermod
Changing Shell To Zsh With usermod command

Method 2 – Change the default shell manually

You can also change the shell manually by modifying the /etc/passwd file using a text editor such as vim or nano. Type the following commands in the terminal one by one :

sudo vim /etc/passwd
# or type
sudo nano /etc/passwd
Change The Default Shell Of The User To Zsh
Change The Default Shell Of The User To Zsh

Once the file opens, you should change the user shell as well as the login shell to /bin/zsh (or whichever shell you’re installing). Now, if you’re using the Vim text editor, press the Escape key on the keyboard and type :wq to save and exit and if you’re using nano, then press Ctrl+O to save and Ctrl+X to exit.

Also Change The Root Shell To Zsh
Also Change The Root Shell To Zsh

Now you just have to type zsh to launch it and the next time you restart your PC, you will always be greeted by the beautiful ZSH.


Well, that’s about it. Regardless of the shell which your distribution picks, you can always change and add the stuff which you like and prefer. Linux is, and always will be about freedom, freedom to do whatever you want with your distribution. Although be careful while modifying the /etc/passwd file, you surely don’t want to mess with the wrong settings there.


Arch Wiki – Command Line shells