How to make ZSH the default shell?

Solution 1:

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

Solution 2:

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.