Fish is a smart and user-friendly command line shell for Linux, macOS, BSD and Windows operating systems. This shell is designed to give user powerful features and control without compromising speed and efficiency. In this article we will show you how to install and configure Fish shell on majority of Linux distributions.
Fish shell has the following features.
- Autosuggestions: This shell is able to suggest commands as you type based on history and completion.
- Web Based Configuration: You can set your colors and view functions, variables, and history all from a web page if you have graphical interface in your system.
- Man Page Completions: Fish generated programmable completions by parsing your installed man pages.
- Sane Scripting: The fish shell is fully scriptable with simple, clean and consistent syntax.
- Glorious VGA Color: Has support for 24 bit true color.
- No configuration needed: fish is designed to be ready to use immediately, without requiring extensive configuration.
Install and Configure Fish shell on Linux
In the next sections I’ll show you how easy it is to install and configure fish shell in your Linux system.
1. Install Fish Shell on Linux systems
Install Fish shell on Ubuntu:
sudo apt update && sudo apt install fish
Or from PPA repository (latest release):
sudo apt-add-repository ppa:fish-shell/release-3
sudo apt update
sudo apt install fish
Install Fish shell on Debian:
source /etc/os-release
echo "deb http://download.opensuse.org/repositories/shells:/fish/Debian_$VERSION_ID/ /" | sudo tee /etc/apt/sources.list.d/fish.list
curl -fsSL https://download.opensuse.org/repositories/shells:fish/Debian_$VERSION_ID/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish.gpg > /dev/null
sudo apt update
sudo apt install fish
Install Fish shell Fedora:
sudo dnf install fish
Install Fish Shell on CentOS 8:
sudo yum -y install wget
wget https://download.opensuse.org/repositories/shells:fish:release:3/CentOS_8/shells:fish:release:3.repo -O fish.repo
sudo mv fish.repo /etc/yum.repos.d/
sudo yum install fish
Install Fish Shell on CentOS 7 / RHEL 7:
sudo yum -y install wget
wget https://download.opensuse.org/repositories/shells:fish:release:3/RHEL_7/shells:fish:release:3.repo -O fish.repo
sudo mv fish.repo /etc/yum.repos.d/
sudo yum install fish
Install Fish shell on Arch Linux / Manjaro:
sudo pacman -S fish
Install fish on macOS:
brew install fish
To confirm the version of Fish shell installed on your system, run:
$ fish --version
fish, version 3.7.0
2. Configure Fish shell on Linux
After installation you can open your terminal and type below command to start using fish shell.
$ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
cloudspinx@elearning ~>
Enter exit to exit a fish shell:
cloudspinx@elearning ~> exit
Set Fish as default shell for user
First add the fish shell /bin/fish to /etc/shells with:
echo /bin/fish | sudo tee -a /etc/shells
Then change your default shell to fish with the following command.
$ chsh -s /bin/fish
# For another user
$ sudo chsh -s /bin/fish <username>
Logout”
$ exit
Login back and confirm active shell.
$ echo $SHELL
/usr/bin/fish
Your fish shell configurations files are located in the following directory
~/.config/fish
3. Install oh-my-fish framework
Oh My Fish provides core infrastructure to allow you to install packages which extend or modify the look of your shell. It’s fast, extensible and easy to use.
Install git
dependency:
sudo apt install git -y
Install it by running the commands below:
$ curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
Checking for a sane environment...
Installing Oh My Fish to /root/.local/share/omf...
Using release channel "stable".
Cloning master from https://github.com/oh-my-fish/oh-my-fish.git...
Writing bootstrap to /root/.config/fish/conf.d/omf.fish...
Setting up Oh My Fish configuration...
Updating https://github.com/oh-my-fish/packages-main master... Done!
Installing package default
✔ default successfully installed.
Installation successful!
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
For more details about its usage check official Github documentation.
How To Uninstall Fish Shell
If you wish to uninstall fish, first ensure fish is not set as your shell.
chsh -s /bin/bash
Next, run install command that matched your Linux distribution to remove fish shell.
In our next article we will look at how you can configure Fish shell with Oh My Fish framework. Here are other guides that could be of interest to you.