TL;DR
To change shell in Linux, you can try the following methods:
chshCommand: Usechsh -s /path/to/desired/shelland authenticate to switch your default shell./etc/passwdFile: Manually edit/etc/passwdfile, changing the shell path and logout/login for the changes.- Installing a New Shell: Install the shell through the package manager, then use
chshto set it as default.
To see all available shells on your Linux system, check the contents of the /etc/shells file. This will display a list of installed shells, such as Bash, Zsh, sh, and Fish. For changing shells, use the chsh command with the desired shell’s path. Customize your new shell, install plugins and themes for added functionality, and don’t hesitate to revert to the default shell if needed.
Read the article below to learn different methods to change shell in Linux and the tips and tricks to change shell in Linux.
In Linux, a shell is a command-line interpreter that lets you communicate with the operating system through text-based commands. It acts as a bridge between the user and the kernel, processing commands and providing output accordingly. Changing shells in Linux offers enhanced productivity, personalization, access to advanced features, an easier learning curve, and the ability to adapt to different tasks. In this article, I will explore different methods to change shell in Linux and the expert tips and tricks to follow when changing shells.
How to Change Shell in Linux
To change shell in Linux, there are three methods. The first one is using the chsh command, which allows a quick switch to a different shell with authentication. The second method involves manually editing the /etc/passwd file to change the default shell, providing hands-on control. The third approach is installing a new shell via the package manager, enabling users to explore different shells without altering the system’s default setting.
1. chsh Command
The chsh command is a quick and straightforward method to change your default shell, ideal for users who want an immediate switch. By using the chsh command, users can swiftly switch to a different shell, experiencing its unique features and improved functionality without any manual file editing. Here’s how to do it:
- Open a Terminal window. You can do this by pressing Ctrl + Alt + T.

- Type the following command and press Enter:
<strong>echo $SHELL</strong> - The output will display the path of your current default shell.

- Type the following command to change shell using
chshcommand:
<strong>chsh -s /path/to/your/desired/shell</strong> Replace /path/to/your/desired/shell with the path of the shell you want to use. For instance, to switch to Zsh, you would use /usr/bin/zsh.
- You will be prompted to enter your user password for authentication.

- Once authenticated, the shell change will take effect immediately.

2. /etc/passwd File
Manually editing the /etc/passwd file suits users who prefer a hands-on approach and full control over their shell change. With direct access to the /etc/passwd file, users can make detailed adjustments, ensuring a seamless transition to the desired shell while maintaining a personalized command-line environment. Please proceed with caution and make backups before proceeding:
- Access your command window and use a text editor such as nano or vim to open the
/etc/passwdfile:
<strong>sudo nano /etc/passwd</strong> - The command will open the /
etc/passwdfile in nano editor.

- Locate the line that corresponds to your username. It should look like this:
<strong>your_username:x:1000:1000:Your Name,,,:/home/your_username:/bin/your_current_shell</strong> - Change /bin/your_current_shell to the path of the shell you want to use (e.g., /bin/zsh for Zsh).
- Save the file and exit the text editor.

- Logout and log back in for the changes to take effect.

login-again-to-view-shell-change
3. Installing a New Shell
Installing a new shell through the package manager is an excellent option for users curious about exploring different shells without changing the system’s default shell. Follow these steps:
- Launch your command prompt.
- Use the appropriate package manager to install the desired shell. For example, to install Zsh, run the following command:
<strong>sudo apt update</strong> - The command will update the system packages.

- Now run the following command command to install Zsh:
<strong>sudo apt install zsh</strong> - After installation, you can set the installed shell as your default using Method 1.

How to see all the shells available on your Linux system?
To see all the shells available on your Linux system, you can check the contents of the ‘/etc/shells’ file. This file typically lists the paths of all the shells installed on your system. Keep in mind that the ‘/etc/shells’ file may vary slightly between different Linux distributions, but it generally serves the same purpose of listing available shells. Some distributions may also store this information in a different location, but the ‘/etc/shells’ file is the most common place to find it. Here’s how you can view the available shells:
- Open a Terminal window on your Linux system.
- Type the following command and press Enter: