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:
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:
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:
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:
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:
Once you are done, save the file and run the following command to verify the changes:
You can change the default shell on Ubuntu through the usermod command. Here is a simple example that you can also try:
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.