6

I'm trying to set fish as my default shell. It's installed on the system through apt-get and is listed in /etc/shells:

> which fish
/usr/bin/fish
> grep fish /etc/shells
/usr/bin/fish

I used chsh to switch from Bash to fish:

> chsh -s /usr/bin/fish

And my default shell has been changed in /etc/passwd:

> grep "myusername" /etc/passwd
myusername:x:1000:1000:Oh Spite,,,:/home/myusername:/usr/bin/fish

Awesome. Then I logged out and rebooted. Login shells (e.g., virtual TTYs and SSH) now start fish.

And yet, when I start a terminal with either gnome-terminal or urxvt, a bash session is started. Additionally, the SHELL variable is still set to /bin/bash.

Interestingly, Terminator does use fish as the default shell. But even in that session SHELL is set to /bin/bash. If I start urxvt from Terminator, urxvt starts a Bash session.

What else do I need to do to change my default shell to fish?

(See also this question, but this is not a duplicate because I have followed those instructions and rebooted. Many times now.)

ohspite
  • 233
  • 2
  • 10

2 Answers2

5

Most terminals (at least gnome-terminal, urxvt, and XTerm, for example) that are started within a desktop environment such as Unity will use the SHELL environment variable to select the shell when they are launched.

SHELL should automatically be set to your default shell listed in /etc/passwd, but the variable can be overwritten when you log in. Make sure you have not set SHELL=/bin/bash or something similar in a file that will affect your entire desktop session. Such files include:

  • ~/.profile
  • ~/.pam_environment
  • /etc/environment
  • maybe some other files edited by Ubuntu users less often, such as /etc/profile

Additionally if any scripts such as ~/.bashrc or ~/.bash_profile are called by those other startup files and there is an export SHELL=/bin/bash line, that will also affect the entire desktop session.


I know it's acceptable/encouraged, but I still hate answering my own question. Nevertheless, this may be of some use to someone in the future. Thanks to @heemayl and @muru for helping me investigate.

ohspite
  • 233
  • 2
  • 10
1

To set fish as the default shell for gnome-terminal, from gnome-terminal go to :

Edit > Profile Preferences

then go to Title and Command tab, you will get :

before

Change it as :

after

Now whenever you start a new instance of gnome-terminal, fish will be started instead of bash.

heemayl
  • 93,925