All servers deployed on Vultr are configured to use the Bash shell by default. Fish is an alternative for Bash that provides the following additional features:
This tutorial will teach you how to install Fish on Ubuntu Server.
You can install Fish with
apt-get install fish
You can now enter the Fish shell simply by typing:
You can set Fish as your default shell instead of Bash:
chsh -s /usr/bin/fish
This way, Fish will be used automatically every time you log in. Test this setting by exiting SSH, then logging back in. Upon logging in, you will be presented with a Fish shell.
In order to be able to change the properties of the Fish shell, we first need to create a config file.
mkdir -p ~/.config/fish vim ~/.config/fish/config.fish
By default, Fish will show this message when you enter the shell:
Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish
You can remove this message by adding the following to the
set -g -x fish_greeting ''
This will remove the message and rather set it to a blank value. You can add something such as "Welcome to my server!" by entering a value instead of leaving it blank:
set -g -x fish_greeting 'Welcome to my server!'
If you would like to use Bash again, simply type:
If you want to permanently use Bash as your default shell, type:
chsh -s /bin/bash
Fish will suggest file names and commands while youâre typing. For example, say that you have a file called
test.txt in your home directory. You would only have to type
vim ~/te and Fish will complete that to
~/test.txt for you.
Exporting variables isnât done with the
export command. Fish uses the
set command. To export a variable, given that the variable name is
Var and the value is
Val, youâd execute:
set -x Var Val. If you would like to see the value of
env | grep Var. This will return the value like this:
In order to remove (erase) a variable, given that the name of the variable you want to erase is
Var, you can type
set -e Var. You will notice that running
env | grep Var now produces an empty output list.
If you would like to learn more about the usage of Fish, please refer to the official documentation.