sudo apt-add-repository ppa:fish-shell/release-4
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.'
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.
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"
You may need to change the shell that the terminal program points to as well:
Go to the preferences of your terminal app.
Check 'Command > Run a custom command instead of a shell'
In the 'Custom Command:' field, type the path to fish on your system, i.e. '/usr/bin/fish' without the quotes.
Close the preferences dialog.
Quit and Re-launch the shell.
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.