How to Install Fish Shell on Debian 10

Updated on November 21, 2023
How to Install Fish Shell on Debian 10 header image

Servers on Vultr are deployed with the Bash shell by default. Fish (friendly interactive shell) is an alternate shell that tries to be more user-friendly and interactive than other shells. In this tutorial, we will install Fish on a Debian 10 Vultr instance.

Prerequisites

Install Fish on a fully updated Debian 10 instance.

Install Fish

Install Fish with the following command.

$ sudo apt install fish -y

Launch Fish

To start Fish:

$ fish

To exit Fish:

$ exit

Configure Fish

Start with a default configuration file.

$ cp /usr/share/fish/config.fish ~/.config/fish

To change the configuration, open the configuration file with a text editor.

$ nano ~/.config/fish/config.fish

For example, to remove the default welcome message, add the following line at the beginning of the file.

set -g -x fish_greeting ''

How to Use Suggestions

Fish will suggest file names and commands as you type them. For instance, if you would like to edit the file in your home directory called test.txt, you can type nano ~/te, and Fish will preview the rest of the filename. Press the Right arrow key to accept the suggestion. Fish offers more complete suggestions than Bash because it indexes the man pages and gathers program arguments.

Variables

To set variables in Fish, use the set command. For instance, to assign the variable Foo the value BAR:

$ set Foo BAR

To unset Foo:

$ set -e Foo

Display all variables

Use the env command to display all variables..

$ env

Help

Use the help command for online documentation.

$ help

Set the Default Shell

To make Fish your default shell, use chsh.

$ chsh -s /usr/bin/fish

Log out, and log back in for this to take effect.

To restore Bash as the default shell, use chsh, log out, and log back in.

$ chsh -s /usr/bin/bash

Conclusion

For more information and configuration options, see the Fish shell documentation.