From Gentoo Wiki
Jump to:navigation Jump to:search


fish - the friendly interactive shell.

fish is a smart and user-friendly command line shell for OS X, Linux, and the rest of the family. fish includes features like syntax highlighting, autosuggest-as-you-type, and fancy tab completions that just work, with no configuration required.



Install app-shells/fish:

root #emerge --ask app-shells/fish


In Gentoo, the login shell, i.e. the user's first shell after logging in, has to read /etc/profile, which reads /etc/profile.env. The latter in particular is indispensable. See the article Login#Login shell in Gentoo for the details.

However fish can not read these files. Thus it is strongly advised not to set fish as the login shell. (There is no reliable way to fix this. See bug #545830.)

Yet there is a good workaround. See the next section.

Those who really, truly, actually wish to set the fish shell can jump down to Setting the fish shell as the login shell.

Alternative to fish as the login shell

The following workaround allows you to use fish by default, by using ~/.bashrc as a wrapper, instead of setting fish as the login shell by chsh -s fish. It was suggested by one of the fish developers and the Arch wiki.

It enables the fish shell to inherit the bash environment (which written in and should be executed by the bash shell):

FILE ~/.bashrc
if [[ $- != *i* ]] ; then
        # Shell is non-interactive.  Be done now!

# Put your fun stuff here.

# keep this line at the bottom of ~/.bashrc
[ -x /bin/fish ] && SHELL=/bin/fish exec /bin/fish

Please note it should not be run for non-interactive shells, so make sure it's placed below the test for interactive shell.


An utility bass executes a given command in bash and then transfers updated environment variables back into fish. With bass, one can then make fish load the system-wide environment variables simply by adding following line to their ~/.config/fish/ file:

FILE ~/.config/fish/
bass source /etc/profile

Setting the fish shell as the login shell

Those who really wish make fish their default login shell can change the shell:

user $chsh -s /bin/fish
After setting fish as the login shell there probably will be entries missing in the PATH variable and some packages that rely on /etc/profile.d broken.


fish starts by executing commands in ~/.config/fish/ . You can create it if it does not exist. Since the version 2.0 it is possible to configure fish within a web browser session by running:

user $fish_config

Fish can generate completions from man pages. To generate completions run:

user $fish_update_completions

External resources