Switching to Fish Shell

Hello,

My current default shell is Bash. I heard so many good things about Fish shell. I want to install and switch to it instead of Bash.

Can anybody help me in switching to fish-shell with details?

Did you try reading the arch wiki entry?
https://wiki.archlinux.org/index.php/Fish

Quick steps:

  1. yay fish to install fish shell
  2. chsh -s /usr/bin/fish to make fish the default shell.

I highly reccomend reading the entry on arch wiki. (link I posted above)

Also read this section to know more about changing shells :point_down:
https://wiki.archlinux.org/index.php/Command-line_shell#Changing_your_default_shell

2 Likes

Yes, I did so.
I changed user and root shell to Fish. But each time I am opening Terminal, default user shell is still Bash!
I need to manually give the command ‘fish’ and press enter to switch to Fish shell. Default shell for root is Fish, problem is with User.

You may need to logout and login again.

Edit:
chsh -s /usr/bin/fish and then logout and login makes the change permanent for me.

4 Likes

I don’t suggest changing settings for root user. Change it only for your user.

2 Likes

Do not do this, Bash should be the default shell for the root user.

If you changed it, revert it by doing

su

Type your root password, and then:

chsh -s /usr/bin/bash

Finally,

exit
4 Likes

It’s not like BASH. If you need other people to tell you how to switch, you probably shouldn’t do it!!

3 Likes

just curious on this.

I installed the Fish shell and haven’t made it default yet. I only have one user (i.e when PC starts, I only have one user to log in to). Is there any harm in changing the shell from Bash to Fish with these two commands as per Fish website?

echo /usr/local/bin/fish | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish

Fish Shell Website

Is your fish shell installed to ‘/usr/local/bin’? Where did you install it from?

Either way, I don’t recommend changing your shell to fish. I would recommend instead that you change your terminal to launch fish. That way you keep bash as you default shell for session initializatiom but you can still use fish interactively.

1 Like

Hi Dalto. I just installed it through terminal from the Arch Packages.

I am currently running it as interactive shell.

I modified .bashrc and added the line exec fish

Just wanted to know if it’s harmful to make Fish default.

I can continue to use it as interactive. Just thought I would ask before breaking my system :wink:

Don’t follow those instructions. If you want to make it the default, you can simply use chsh -s /bin/fish.

Although, as I stated above, I would set it as the shell in your terminal instead of that or exec’ing fish from your .bashrc.

Got it. I don’t have any issues in using as an interactive shell. I’ll keep as is.

Which instructions you are referring to btw? One from Fish wiki or Arch wiki?

The ones from the fish wiki you posted above.

Aah got it. Thanks for clarification

As I believe fish is not fully POSIX compliant like bash, sh, ZSH … etc. And there difference between how fish does stuff and the normal bash. For example, fish doesn’t like $ sign. So, when we use a script that is written run in normal shells needs to be adjusted to properly work with fish. Due to this, changing the default to fish would break most scripts that are used in the system. You can get similar functions with ZSH (without using Oh My ZSH) and it’s a much better shell.

Most people like fish it comes with some basic stuff preconfigured like command history, command completion, and customizable prompts. I used fish for some time I liked it but as I grew with experience in shell scripting and all I noticed that ZSH is a better shell to use. Fish is a good shell to use as an interactive one but don’t make it your default.

My advice to OP is first to get familiar with bash. Because you needed to ask people how to change the shell itself. Once you’re familiar with bash then switch because by that time you would have enough knowledge to fix things if they go wrong,

This is not accurate. Scripts are run in separate shell sessions, so having Fish as the default shell will not break them.

I do agree with you that Fish should not be the default user’s shell, but not because of scripts, scripts will still work fine because they will be run in separate bash sessions. However, there are other reasons for not using Fish as a user’s default shell.

For example, when you have Fish set as the default shell, some programs (which are sloppily programmed to assume that bash is the default shell) will report mysterious errors and just not work. Additionally, using SSH from a remote machine might be more difficult, as well as using the TTY, in case something breaks and the desktop session is not available. Troubleshooting issues within an interactive Fish session is also more difficult: all help you get on forums assumes you’re using Bash.

This is also, but to a much minor extent, true with Zsh, I would not recommend setting it as user’s default shell either. However, Zsh is much closer to Bash in syntax and features, and at least all POSIX features should be identical between Bash and Zsh, so that is much less of an issue. I would be surprised if there were any issues with that, but regardless, I don’t see a point in ever changing the default user’s shell from Bash (on Arch, at least). It’s easier to simply reconfigure your terminal emulator to start with a different shell, than to worry about potentially mysterious issues that may or may not happen when you chsh.

3 Likes

Did not know this thank, you boss.

Yeah, I do agree with this Bash is kind of more than enough. I personally liked Zsh that’s why I changed it and had no issues up to now. But Bash can be made into having most of the bells and whistles other shells have too by using plugins.

I also use Zsh all the time, but my default user’s shell is Bash. I almost never see it though, except in the TTY and over SSH. I have console launch Zsh on startup. The same way it can launch Fish or any other shell. There is no need to chsh at all in order to use other shells.

Why it is not good idea to set fish or zsh as a default user’s shell ?

fish is intentionally not fully POSIX compliant and works slightly different than bash. Meaning that some scripts may not work; can include scripts crucial for the system.

But if the script has correct shebang, this shouldn’t be an issue. How many scripts don’t have correct shebang? No idea. Arch Wiki used to carry a message saying that some scripts on Arch are written only for bash and won’t work if using fish as the default shell.

In Arch, some shell scripts are written for Bash and are not fully compatible with fish. Not setting fish as system wide or user default allows the Bash scripts to run on startup, ensures the environment variables are set correctly, and generally reduces the issues associated with using a non-Bash compatible terminal like fish. You may see some script errors if your default shell is set as fish. Below are several options for using fish without setting it as your default shell.

Source

There doesn’t seem to be many issues these days. The above text was removed from the wiki. Currently, the wiki carries instructions on setting fish as default, without any prominent warning against it.

As for zsh, I’m using it as default since a few years now. Never faced any issues.

2 Likes