When you open a terminal in Ubuntu Linux, you are interacting with a “shell.” The shell is the program that takes the commands you type and passes them to the operating system to execute. By default, Ubuntu uses the Bourne Again Shell (bash). While bash is incredibly powerful and ubiquitous, many developers prefer alternative shells like Zsh (Z shell) or Fish (Friendly Interactive Shell) due to their advanced auto-completion, powerful plugin ecosystems, and customizable prompts. If you want to permanently switch your terminal environment, you must change your default shell using the chsh command.
Prerequisites
Before you can change your default shell, you must ensure the new shell is actually installed on your system. For example, if you want to switch to Zsh, you must first install it using the package manager:
sudo apt updatesudo apt install zsh
Finding the Path of Your New Shell
To change your shell, the system needs to know exactly where the shell’s executable file is located on your hard drive. You can find the exact path of any installed shell using the which command.
For example, to find the path to Zsh, type:which zsh
The terminal will output the absolute path, which is almost always /usr/bin/zsh or /bin/zsh. Write this path down.
Using the chsh Command
The chsh (Change Shell) command modifies your user profile configuration.
- Open your terminal.
- Type the following command:
chsh - Press Enter.
- The system will immediately prompt you for your user password (the one you use to log in or use
sudo). Type it and press Enter. (Note: As a security feature, no characters will appear on screen while you type). - The prompt will now ask you to enter the new value, displaying your current shell in brackets. It will look something like this:
Enter the new value, or press ENTER for the defaultLogin Shell [/bin/bash]: - Type the exact absolute path you found earlier (e.g.,
/usr/bin/zsh). - Press Enter.
Applying the Changes
You might notice that nothing happened immediately. Your current terminal window is still running bash. The chsh command changes your default shell for your user session, which means the change will only take effect the next time you log in.
To apply the changes, you must fully log out of your Ubuntu desktop session and log back in. If you are connected via SSH to a headless server, you must disconnect and reconnect your SSH session. Once you log back in and open a new terminal window, you will be greeted by your new default shell.