Fish shell: The user-friendly alternative to Bash

If you use Linux, you probably know about the Bash shell. It is the default shell in most Linux distributions and gets most of the work done. You might have even heard of a more customizable Z shell or zsh . However if you are looking for a more user-friendly and efficient shell, with features like autocomplete out of the box, the fish shell is the way.

Introduction to Fish

The Friendly Interactive Shell or fish in short is a smart and feature rich shell for Linux, MacOS and other Unix like operating systems. Here are some of the features of fish that make it worth a try.

  • Autosuggestions : Everyone is a fan of autocomplete whether that be in IDEs or texts. Now you can add it in terminal too with fish. fish suggests commands as you type them based on your history. You can also navigate these suggestions by arrow keys like in a drop menu.
  • Man page completion : fish also parses the man page of the command to suggest all the flags that you can use.
  • Scripting : fish can be easily programmed or scripted to your liking.
  • Web-based configuration : You can change your fish configuration from a web page.
  • Syntax highlighting : fish colors the commands depending on whether they are valid, invalid, contain a directory path etc.

Installing Fish on Linux

Now that you are sold on fish, lets get started with the installation process. Thankfully fish provides us with binaries already so it shouldn’t be a problem.

Ubuntu

For Ubuntu, we have to add a PPA and then install. To do that execute the following.

sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish

Debian

For Debian 11, run the following command. It will add a repository in Debian 11 (if its missing) and then install fish from it.

echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_11/ /' | sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_11/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg > /dev/null
sudo apt update
sudo apt install fish

Replace the Debian_11 in the command with Debian_9.0 or Debian_10 if you are using Debian 9 or 10 respectively.

Fedora

For Fedora 37 run the following command. Just like the Debian command, this will first add a repository (if its missing) and then install fish through it.

dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:3/Fedora_37/shells:fish:release:3.repo
dnf install fish

For Fedora 36 :

dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:3/Fedora_36/shells:fish:release:3.repo
dnf install fish

Arch Linux

You can install fish on arch through pacman.

 pacman -S fish 

Gentoo

Similar to arch, you can use emerge to build it on Gentoo.

 emerge fish 

Other distributions

If you use Void Linux, Solus, Guix, NixOS or CentOS you can visit this downloads page for the command to install it.

Getting started with FISH on Linux

After you have downloaded, go ahead and execute fish on your bash terminal to launch fish.

Fish Shell In Use

Now trying using it just like you normally would. Try pressing the up and down arrow to scroll through the suggestions. You can also use the advanced tab autocomplete.

Fish Tab Drop Down

config.fish – The configuration file for the complete set

Just like bash takes its configurations from .bashrc , you can edit fish configuration from config.fish . By default its path is ~/.config/fish/config.fish

How to set fish as the default shell?

If you liked fish, you can go ahead and set it as the default shell over Bash. To do that, list all shells using cat /etc/shells and then execute chsh to change the shell.

Chsh

Conclusion

In this article we saw the different features of the fish shell. Unlike bash and zsh, fish provides us with user friendly features which can be used out of the box with minimal setup. If you want to look at different configurations and eye candy for fish , I recommend Oh-My-Fish. This makes it easier to customize the looks of the shell to your liking and provides different themes that you can use out of the box. If you are looking for something similar to fancify your bash terminal, take a look at bash-it.

Read further: