Sometimes you want to change your default shell on your Linux system to a different one. This is a step-by-step guide.
✅ Check Your Current Shell
You can check what shell you’re currently using with:
echo $SHELL
You can also view the default login shell for your user by checking /etc/passwd
:
grep "^$USER" /etc/passwd
🔄 Change Your Default Shell (per user)
To change your default shell, use the chsh
(change shell) command:
chsh -s /path/to/shell
- The
-s
option means “set shell”. - The change applies at next login.
- You’ll likely be prompted for your user password.
⚠️ Common Issue
If you see this error:
chsh: /bin/fish is an invalid shell
…it means the shell binary is not listed in /etc/shells
(the list of allowed login shells).
You can inspect it with:
cat /etc/shells
📦 Installing Zsh and Fish on Ubuntu
First, update your package list:
sudo apt update
Then install either shell:
🌀 Install Zsh:
sudo apt install zsh
🐟 Install Fish:
sudo apt install fish
Check again:
cat /etc/shells
Example output:
/bin/zsh
/usr/bin/zsh
/usr/bin/fish
NOTE
fish
is not considered essential for boot/recovery, so it’s installed in/usr/bin
.- This follows Linux conventions: essential tools →
/bin
, user-space tools →/usr/bin
.
Now set your default shell:
chsh -s /bin/zsh # For Zsh
chsh -s /usr/bin/fish # For Fish
Logout and log back in to see the change.
👥 Changing Shell for Another User (as root)
If you’re root, you can change another user’s shell like this:
sudo chsh -s /bin/bash carlos
Or, more dangerously, by editing /etc/passwd
manually (not recommended).
# Be cautious with:
sudo nano /etc/passwd
👀 Prompt Differences Between Bash, Zsh, and Fish (Quick Peek)
One of the most obvious differences between the different shells is the prompt
Bash prompt
-
Classical
-
It is customizable via
.bashrc
.
Fish prompt
- Colorful
- Auto-suggestions by default
Zsh prompt
- Support themes like
agnoster
,robbyrussell
Related Note
Customizing Your Linux Shell: Oh My Zsh, Oh My Bash, and Prompt Styling