How do I switch from an unknown shell to bash?

I was surprised that I didn’t find this question already on the site. So, today $ came up after I logged in as a new user. This was unexpected because my main user’s prompt starts with username@computername:~$.

So, how do I switch from this other shell to bash?

Asked By: mouche


You type in bash. If you want this to be a permanent change the default shell to /bin/bash by editing /etc/passwd.

Here’s some snippets from my /etc/passwd:

avahi:x:84:84:Avahi daemon:/:/bin/false
usbmux:x:140:140:usbmux user:/:/sbin/nologin

The very last field contains the shell, Modifying the field after the last : to a valid or invalid shell will work. /bin/false and /sbin/nologin both mean the user doesn’t have a real login shell, although if pam is not set up right this doesn’t mean they can’t login (I reported a bug on this in Arch Linux, because you can login graphically without having a login shell). /bin/bash and /bin/zsh are both valid shells, see /etc/shells for a list of valid shells on your systems. Here’s my /etc/shells if you’re interested.


Yes you can use chsh or usermod to do the same things, please remember these are just structured text files, and TIMTOWTDI.

Answered By: xenoterracide

Assuming the unknown shell supports running an absolute command, you could try: /bin/bash

To change the default shell, I would use chsh(1). Sample usage: chsh -s /bin/bash $USER

Answered By: Kevin M

If chsh or manually editing the config won’t work, but a ~/.profile script is executed at login, add this line:

exec /bin/bash --login
Answered By: Kevin Cantu
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.