How do I set fish as the default shell?

195,404

Solution 1

You can set fish as your default shell by running

chsh -s $(which fish)

To do so for another user, just add the username at the end of the command, and use sudo.

Then log out and back in.

(To set it back to bash, you need to use Fish syntax of course, like this chsh -s (which bash))

Solution 2

usermod -s /usr/bin/fish username

Must be run as root though.

This will change the shell permanently for the specified user.

Solution 3

I just added the line fish to the end of my .bashrc.

Solution 4

I agree with the chsh is the correct answer. However:

If you run chsh and get error

/usr/local/bin/fish: non-standard shell

simply add the fish binary location to /etc/shells.

Found here.

Solution 5

In /etc/shells, add /usr/local/bin/fish:

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/fish

Then chsh -s /usr/local/bin/fish.

Share:
195,404

Related videos on Youtube

Xodarap
Author by

Xodarap

Updated on September 17, 2022

Comments

  • Xodarap
    Xodarap over 1 year

    Is there a way to set fish as the default shell in ubuntu netbook remix? I put in my .bashrc to run fish, which works fine, but ubuntu recognizes it as fish running inside bash, which means that when I try to close the shell it warns me that a task is still running.

    It doesn't pop up as a new application, so I can't pin it to my bar like a normal app.

  • Xodarap
    Xodarap about 13 years
    This doesn't seem to work for me. It doesn't give an error, but it just doesn't seem to work, even if I just open a new tab. Any thoughts?
  • CWSpear
    CWSpear over 10 years
    I know it's not Ubuntu, but I wanted to comment: I was on CentOS, and I was getting an Authentication Failed error trying to change the shell with a non-root user and after extensively searching to try and figure it out, this was the only thing that worked. Thanks!
  • sweetfa
    sweetfa over 10 years
    Yes it will work on most unix flavours that have usermod and fish for a shell, or change the shell to whatever flavour you wish
  • knutole
    knutole almost 10 years
    How do you set it back?
  • lindhe
    lindhe over 9 years
    That should be chsh -s /bin/bash.
  • Stephen Niedzielski
    Stephen Niedzielski about 9 years
    Don't accidentally run this command with sudo or you'll change the root shell instead.
  • ptkato
    ptkato over 8 years
    I did that and now the terminal doesn't start anymore. I get "There was an error creating the child process for this terminal", "Failed to execute child process "/usr/bin/fish" (Input/output error)". How can I undo that?
  • sweetfa
    sweetfa over 8 years
    Issue the same command as root but use bash instead of fish as the shell.
  • Wtower
    Wtower about 8 years
    Or chsh -s (which fish) from inside fish.
  • electronix384128
    electronix384128 over 7 years
    That's the simplest and best solution, IMO ;)
  • M. Junaid Salaat
    M. Junaid Salaat about 7 years
    Sorry, but its not efficient. :) It will load your fish shell but on top of your bash running.
  • codenamejames
    codenamejames almost 7 years
    Why does bash need to be efficient? @M.JunaidSalaat
  • Grumpy ol' Bear
    Grumpy ol' Bear about 6 years
    What's the default shell for Linux Mint 18.3 cinnamon, i.e. if I want to go back to how it was...
  • Naheel
    Naheel almost 6 years
    From the first glance this seems like a dirty hack, but after a while of using my pc with fish set as the default shell with chsh I came back to this solution. Some programs assume that you're using bash and will crash because of using bash syntax on fish. So far I faced such problems in i3wm and matlab.
  • Mike Marek
    Mike Marek almost 5 years
    @codenamejames: It's not that bash needs to be efficient, or that those few milliseconds matter, but it's a case of nothing to lose, so why not do it correct? Especially here where we are giving advice to other people. We should know better
  • Florian Wendelborn
    Florian Wendelborn almost 5 years
    This is necessary to do on macOS Mojave.
  • Antony Stubbs
    Antony Stubbs about 4 years
    Does this work without doing askubuntu.com/a/1025536/476086 ?
  • TimNode
    TimNode over 3 years
    This works on MacOS Big Sur
  • Enrique René
    Enrique René over 3 years
    I see this a bad practice for "defaulting" a shell. Bash and Fish have different syntaxes. Bash for example declare variables as VAR=some_var and fish as set VAR some_var. There is no .bashrc for fish (fishshell.com/docs/current/faq.html). I expect close terminal when run exit command. Running fish from bash, after exit command I got back to bash terminal.
  • haolee
    haolee about 3 years
    This will break your system. The desktop can not be displayed normally and the scp command won't work neither.
  • mesqueeb
    mesqueeb over 2 years
    @dorian it says I can't edit the file. how can I edit it?
  • Ricardo Biehl Pasquali
    Ricardo Biehl Pasquali over 2 years
    @M.JunaidSalaat By using exec (which is POSIX compliant), the command argument will replace the shell (i.e. will be executed with execve() system call). Bash will no longer be running. Environment variables are preserved, though.
  • Admin
    Admin almost 2 years
    @mesqueeb you need to sudo nano /etc/shells for instance if you want to edit with nano