How to Change the Default Shell in Ubuntu 22.04

Shell is a CLI (command line interpreter) utility which is essential in Linux. Shell has various types, but Bash (Bourne Again Shell) is the most popular. Bash is the default shell utility in different Linux distros, including Ubuntu.

However, many Ubuntu users always want to know how to change the default shell but they always get errors. In this short tutorial, we will explain the simple methods to change the default shell on Ubuntu 22.04

How to Change Default Shell on Ubuntu 22.04

First, verify which one is the default shell of your system. You can check it through the following command:

grep `whoami` /etc/passwd

In the previous command, we used the whoami command in the backtick to evaluate the user’s name. Similarly, you can also run the following command to display the default shell in a simpler format:

echo $SHELL

Change the Default Shell

The chsh command can change the default shell. You can run this command with the -s option (sets the shell as the login shell) to change the shell easily:

chsh -s /bin/zsh

Note: If your system does not contain the shell that you want to use, install it before using the previous command.

You can change the default shell for another user. Run the following command:

chsh -s <username>

If you want to go for the simple method, all you have to do is edit the /etc/passwd file as shown in the following:

sudo nano /etc/passwd

Once you are done, save the file and run the following command to verify the changes:

grep `whoami` /etc/passwd

You can change the default shell on Ubuntu through the usermod command. Here is a simple example that you can also try:

sudo usermod --shell /bin/csh <username>


This is all about the simple approaches that you can use to change the default shell on Ubuntu 22.04. We explained the three methods, but changing the /etc/passwd is the simpler method that you can try. Moreover, you can also check the default shell using the grep “whoami” /etc/passwd command.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.