In the terminal, many users stick with Bash. As a result, their terminal experience isn’t as good as it could be. It’s very basic, with no modern features out of the box. If you want a better terminal experience, consider switching from Bash to Fish Shell.

Install Fish Shell

Before switching from Bash to Fish Shell as your primary terminal Shell, you’ll need to install it on Linux. Luckily, its very popular and there are packages of it on pretty much every Linux distribution out there. Open up a terminal and enter the command below to install it.

Ubuntu

sudo apt install fish

Debian

sudo apt-get install fish

Arch Linux

sudo pacman -S fish

Fedora

sudo dnf install fish

OpenSUSE

sudo zypper install fish

Other Linuxes

Fish has been around for a while, despite being fairly modern in features. Due to its age, it’s pretty easy to get it on just about any Linux distribution. To install it, open up a terminal and check your package manager for “fish” or “fish shell”. Alternatively, check out the official Github page and build it from source with the program code.

Switch Bash To Fish Shell

Using Fish as the primary shell may take some getting used to, as it is very different from Bash. Unlike a lot of other alternatives (like Zsh, Ksh, etc), Fish isn’t using the Bash system as a base. Since Fish has this design, some commands may flat out refuse to work due to a different syntax, and you’ll likely have to change some habits when using the terminal.

Lucky for you, there’s a great page that outlines all of the intricacies of the Fish Shell and environment to look over. It outlines the Fish Syntax, how it handles piping, and so many other things. If you’re considering making the switch, do yourself a favor and give it a read.

‘);
if (navigator.appVersion.indexOf(“Mac”)!=-1) document.write(”);

RECOMMENDED FOR YOU

Once you’ve looked the cheatsheet over, it’s safe to open up a terminal and change your user’s default shell from Bash to Fish Shell. In the terminal, run the chsh command. However, do not run it with sudo, or you could potentially swap the Root user’s shell to Fish instead of your own.

chsh -s /usr/bin/fish

Running the chsh command will assign your user the new shell. To gain instant access to Fish with your user, write fish into the terminal. Otherwise, restart your Linux PC to finalize the switch. After rebooting, log back in and open up a terminal again. If everything goes right, Fish will be the new default, and you’ll be greeted with the Fish Shell, rather than Bash.

Configuring Fish

Though you’ve switched to the Fish Shell, it’s not fully ready to use. The next step is to configure it. In the terminal, create a new configuration folder.

mkdir -p ~/.config/fish

Next, create a new configuration file, inside of the new Fish config folder:

touch ~/.config/fish/config.fish

Using touch creates a blank Fish Shell config file with nothing in it. At this point, it’s safe to add any custom configurations into the shell. For most users, the only modification needed is one to permanently disable the welcome message. Add the modification to the Fish config by running the following command:

echo 'set fish_greeting ""'  ~/.config/fish/config.fish

Backup Fish Config

Setting up Fish on multiple computers can be quite annoying, as you’ll have to create a new config for each PC. A quicker way is to create a backup of the file and restore it on each PC you plan to use Fish on. To back up the config, run this command in the terminal

cp ~/.config/fish/config.fish ~/Documents/

To restore the config, move the file to the new PC, place it in the Documents folder and run:

mkdir -p ~/.config/fish

cp ~/Documents/config.fish ~/.config/fish/config.fish

Customization

For the most part, Fish is all set up and ready to use. However, if you want to customize and configure it further, there’s a way to do that. Go into the terminal and run this command:

fish_config

Running this command will automatically open up a new tab in your web browser, with it’s possible aspects of Fish.

In the Fish_Config window, you’ll be able to apply preset shell themes, assign variables, set custom functions, view command history, assign abbreviations, aliases and more!

Fish Autocomplete

By far, the most attractive feature in Fish is the autocomplete feature. It’s so far ahead of everything else, and this one feature alone is enough to convince even the most diehard of Bash fans to check it out. The best part about this feature is that it doesn’t require a lot of know-how to take advantage of. Even terminal noobs can get a lot of use out of it.

To use the Fish autocomplete feature, go to the terminal and start typing a command. As you type, you’ll see the shell try to guess as you go. It corrects as it receives more information. At any time you can auto-complete a command by pressing the right arrow key on the keyboard. After pressing the correct key, your half-finish command will be automatically completed.

Leave a comment

  • Pingback: How To Switch From Bash To Fish Shell On Linux | SkyNet Chronicles()