The Fish shell is an intuitive unix shell.

Fish is installed on the unix command line (cli). These instructions are quoted from 'How to Install Fish Shell on Ubuntu 26.04, 24.04 and 22.04.'

Quoting

If you want to get the latest version of the fish shell, then you’d have to use the fish shell’s PPA for that purpose.

First, execute the following command to add PPA to your system:

sudo apt-add-repository ppa:fish-shell/release-4

Then, update your system repository to take effect from the changes you’ve made to your system:

sudo apt update

Once done, install the fish shell using the following command:

sudo apt install fish

Now, you can check the installed version:

fish -v

As of the time of writing, Fish was on version 4.7.1.

My Fish Config File

The config.fish file is placed into the .config/fish/ folder in the user’s home folder. You may need to create the folder:

> mkdir .config/fish
# Modified: Mon. 2022-07-04
#
if status is-interactive
    # Commands to run in interactive sessions can go here
   set PATH /home/linuxbrew/.linuxbrew/bin /home/linuxbrew/.linuxbrew/sbin /home/linuxbrew/.linuxbrew/composer/vendor/bin $PATH
   set EDITOR /usr/bin/nano
   set HOMEBREW_CELLAR /home/linuxbrew/.linuxbrew/Cellar
   set HOMEBREW_PREFIX /home/linuxbrew/.linuxbrew

   abbr --add brewf "brew update; brew outdated; brew upgrade; brew cleanup"
   abbr --add aptf "sudo apt update; sudo apt list --upgradable; sudo apt upgrade; sudo apt autoremove; sudo snap refresh"
end

function on_exit --on-event fish_exit
   history clear
end

#sets default creation permissions?
umask 007

export XDG_DATA_DIRS="/home/linuxbrew/.linuxbrew/share:$XDG_DATA_DIRS"

Terminal App Shell Change

You may need to change the shell that the terminal program points to as well:

  1. Go to the preferences of your terminal app.

  2. Check 'Command > Run a custom command instead of a shell'

  3. In the 'Custom Command:' field, type the path to fish on your system, i.e. '/usr/bin/fish' without the quotes.

  4. Close the preferences dialog.

  5. Quit and Re-launch the shell.

Using Fish

Exporting variables isn’t done with the export command as in Bash. 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 Var, type: env | grep Var. This will return the value like this:

Var=Val

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.