Home » Questions » Computers [ Ask a new question ]

How do I make Bash my default shell on Ubuntu?

How do I make Bash my default shell on Ubuntu?

I have a .bash_profile in my home directory, but it isn't getting run on login. If I do the following, then things seem to be as I expect:

Asked by: Guest | Views: 288
Total answers/comments: 5
bert [Entry]

"Use:

chsh

Enter your password and state the path to the shell you want to use.

For Bash that would be /bin/bash.
For Zsh that would be /usr/bin/zsh."
bert [Entry]

"Enable bash:

$ /bin/bash

Change shell for user:

$ sudo usermod -s /bin/bash username

where:

-s, --shell SHELL new login shell for the user account"
bert [Entry]

"If you somehow don't see your username in the /etc/passwd file [this is the case when your system is under control of some other domain e.g. in IT companies]
Or it says ""user not found"" with chsh option than below process might help you.

The logic behind the below trick -> On Ubuntu, /bin/sh is dash. You can switch your system to using bash. On Ubuntu, /bin/sh is a symbolic link to dash. You can make it a symbolic link to bash instead.To change it, run

sudo dpkg-reconfigure dash

And press No to switch to bash.

Now, go to Terminal->Edit->preferences->Command and tick the checkbox with statement

Run command as login shell

And that's it."
"If you somehow don't see your username in the /etc/passwd file [this is the case when your system is under control of some other domain e.g. in IT companies]
Or it says ""user not found"" with chsh option than below process might help you.

The logic behind the below trick -> On Ubuntu, /bin/sh is dash. You can switch your system to using bash. On Ubuntu, /bin/sh is a symbolic link to dash. You can make it a symbolic link to bash instead.To change it, run

sudo dpkg-reconfigure dash

And press No to switch to bash.

Now, go to Terminal->Edit->preferences->Command and tick the checkbox with statement

Run command as login shell

And that's it."
bert [Entry]

One alternative is to rename your startup script into .profile. This file is being source by most Unix shells.
bert [Entry]

"There's not enough information in your question for me to say for sure, but I've hit the same problem before. Assuming you've already get /bin/bash set in your password entry, it may be the way your terminal launches.

If you're trying to launch a GUI terminal, say gnome-terminal you may be expecting the shell to read your bash startup files. However, this doesn't happen on Ubuntu and maybe other systems by default.

The way I've fixed it on Ubuntu is to edit the gnome-terminal preferences, and set the startup command to be bash -l. -l is short for --login. This tells bash to startup as as login shell, which causes it to load the startup scripts as you get when logging in via ssh.

I'm sure there's a good rationale for this being the way it is, but I found it surprising and a more than a bit annoying as I share the same profiles across linux, cywgin and macos systems."