How to make ZSH the default shell?
Just using chsh
:
chsh -s $(which zsh)
without sudo
should work. If you use sudo
it will change the shell not for your working user but for root
Finally, log out of your computer and log back in.
Troubleshooting:
- Do you have zsh installed (ii)?
dpkg -l zsh
- Is your shell set to zsh? Last field of
grep $USER /etc/passwd
- Is Zsh a valid login shell?
grep zsh /etc/shells
I found this on superuser forum
Open /etc/passwd:
sudo vi /etc/passwd
Find the line with your username:
username:x:1634231:100:Your Name:/home/username:/bin/bash
and replace bash with zsh:
username:x:1634231:100:Your Name:/home/username:/bin/zsh
Log out and log in back for the changes to take effect.
You may also do this:
open your bashrc file in your favourite editor
sudo nano ~/.bashrc
then add the line below top of the file
exec zsh
It will execute the command every time you load the terminal and run your zsh shell.