1

I installed ZSH and didn't like it and I want to revert back to bash. I uninstalled ZSH before I tried changing the default shell. I uninstalled ZSH and then ran the commands chsh and sudo chsh --shell=/bin/bash $USERNAME but it seems that no matter what commands I use to change the shell it still says that I'm using the ZSH shell when I run echo $?. I'm pretty new to Linux/Ubuntu so can someone point me in the right direction?

  • You do understand that the "shell", kept in /etc/passwd only applies at login time? – waltinator May 22 '16 at 22:32
  • 2
    Have you logged out and back in after changing your login shell? – DopeGhoti May 22 '16 at 23:32
3

you can take a look at the list of shells you have installed with:
cat /etc/shells

For example, to change current shell to bash, you can use the chsh command :
chsh -s /bin/bash

or use the usermod command to change the shell of a user:
sudo usermod -s /bin/bash putHereTheUserName

You can confirm the sheel of the user on /etc/passwd (it's the last element of each line):
cat /etc/passwd | grep putHereTheUserName

| improve this answer | |
1

Remove the old symlink first

sudo rm -v /bin/sh

Now, create a new symlink, assuming that bash is in /bin directory

sudo ln -sv /bin/bash /bin/sh

This should do the trick for you.

| improve this answer | |
  • 3
    /bin/sh on Ubuntu is supposed to point to /bin/dash, and nobody uses /bin/sh as their login shell. This bad advice, and unrelated to the problem at hand. – muru May 22 '16 at 23:36
  • @muru FYI on my Ubuntu /bin/sh is linked to /bin/bash by default and it uses bash as the default login shell. – Abhimanyu Saharan May 23 '16 at 9:11
  • 2
    Then you must have made it so. Ubuntu has used /bin/dash as /bin/sh for years. FYI: wiki.ubuntu.com/DashAsBinSh And I said: nobody uses /bin/sh as their login shell. – muru May 23 '16 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.