Fish shell, the popular free open-source command line shell, release new major 4.0 version yesterday.
Shell is a program that interprets and executes the commands you type in the terminal. Linux has different type shells, e.g., Bourne Shell (sh), GNU Bourne-Again Shell (bash), and C Shell (csh). And, current Ubuntu releases default to bash shell.
Fish, friendly interactive shell, is a feature-rich shell with a focus on interactivity and usability.
The new fish 4.0 release ported the core code from C++ to Rust. For those who want to build it from source, then here are large change in dependencies and and how to build process. But for end users, there should be no direct impact.
Besides switching to Rust programming language, the release also add new bind
key notation. It improved keyboard handling using the CSI u protocol
with fixes/extensions from the kitty keyboard protocol, thus it supports binding more keys, especially ones with ctrl
/alt
/shift
modifiers.
The bind
now supports a human-readable syntax in addition to byte sequences, including modifier names, and key names like enter
and backspace
. For example, bind up 'do something'
binds the up-arrow key, and bind ctrl-x,alt-c 'do something'
binds a sequence of two keys.
There are as well tons of other changes in the new release, including new function fish_should_add_to_history
to decide whether a command should be added to the history, qmark-noglob
feature enabled by default, and much more! See this page for details.
How to Install Fish 4.0
Fish provides pre-build packages available to download in its website:
For Ubuntu and Linux Mint, there’s an official PPA contains deb package for Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04, and Ubuntu 24.10 running on amd64 (INTEL/AMD) platform.
Just open terminal (Ctrl+Alt+T) and run commands below one by one to add PPA and install fish 4.0:
sudo add-apt-repository ppa:fish-shell/release-4 sudo apt update sudo apt install fish
After that, run fish
command in terminal to start using the shell.
Set fish as default shell (NOT Recommended)
NOTE: Change default shell in Ubuntu may break things! You must know what you’re going to do.
Ubuntu defaults to bash shell, and it may contain some system configurations as bash scripts. So changing the default shell may break things.
However, if you insist to set fish as default, simply run command:
sudo chsh -s /usr/bin/fish $USER
This command will set fish for default shell for current user only, and apply change at next login.
To revert back to bash shell, run command:
sudo chsh -s /bin/bash $USER
For more about fish, see the official documents.
Uninstall Fish:
To uninstall fish in Ubuntu, simply open terminal (Ctrl+Alt+T) and run command:
sudo apt remove --autoremove fish
Then, remove the PPA repository by running command:
sudo add-apt-repository ppa:fish-shell/release-4
For Linux Mint you also need to run sudo apt update
to apply change, unless adding/removing PPA via Software Sources utility.