11 Fish Shell Features That Make it More Awesome Than Bash

You should try Fish, even if you are vegan or allergic to seafood :P
Warp Terminal

Bash the most common shell. Zsh is the most popular one among developers. But Fish is the most underrated one.

I am not exaggerating. Fish indeed is an overlooked shell that could be a great fit for beginners and advanced FOSSers alike.

Fish provides a range of features that makes it an attractive choice. From syntax highlight to abbreviation (my favorite), there are numerous novelties here.

Let me share some of my favorite Fish shell features with you.

1. Syntax highlighting

It is better to spot errors before they get executed. This saves a lot of time, energy and frustration.

Most modern code editors have the syntax highlighting built-in. Fish has this functionality built into the shell itself and it works on Linux commands.

Incorrect commands? You see it highlighted in red. The same goes for arguments and options that do not match with the context.

If a typed word is not a command or is not related to the context, Fish will show a red color, marking it as error
Errors highlighted in red

2. Autosuggestions

The Fish shell suggests commands as you type, which you can later complete accordingly using the tab key.

Autocompletion in Fish Shell
Fish Autocompletion

The suggestions will be greyed out as you type, to make it more accessible. If the whole line of suggestion is acceptable to you, you can press the right arrow key to complete it in full.

3. Interactive man page for command options

This is a cool feature, where you will be able to complete a command's options, by taking help from the man page interactively.

First, you need to parse the man page, which can be done by running:

fish_update_completions

This will parse the man pages.

Fish update completions command parsing the man pages
Parsing Man Pages

Now, if you type a command, put a hyphen for the options and then press the tab button to see the man page suggestions for the possible options with their short descriptions:

Fish shell listing the man pages when asked using the tab key
Fish Man Page Help

You can scroll through the options, and select after reading about its work, from the pager that appears.

This makes things a bit more easier than typing command -h.

4. Abbreviations instead of aliases

Abbreviations in Fish are like text-expanders. Here, you will set some frequently used code to an easily accessible abbreviation.

For example, I have used sch as an abbreviation for the command pacman -Ss to search for packages.

abbr -a sch pacman -Ss

Now, whenever I type sch and press the space button, it will be replaced with pacman -Ss.

Abbreviations example in Fish Shell
Fish Shell Abbreviations

You can make it permanent by writing it to the config file.

πŸ’‘
The difference between alias and abbreviation is that an alias works under the hood. You don't get to see the actual commands it is aliased to. Abbreviation will show the actual commands and they are also recorded into the history correctly.

5. Extensive web-based help

Linux purists rely on the man pages to get help with a command. The newer bunch of Linux users are more reliant on the web for such things.

Fish gives a mix of both with its extensive "web-based" help which is easily available on your system, even if there is no internet, since it is stored locally.

To get help, while running Fish shell, just use:

help

This will open the Help page on your web browser.

Web-based help system, opened in Firefox, when typed "help" in Fish Shell.
Fish Shell Web Help

You can refer to the extensive documentation with ease now.

6. Web-based configuration

Yes, another 'web-based' feature.

To change the prompt color or other configurations, you don't need to edit configuration files in the terminal. Instead, you can use the web-based configuration.

Type the following command while running Fish shell:

fish_config

This will open the configuration settings on your browser.

Fish Shell Web-based configuration, opened in Firefox
Fish Shell Web-based configuration

Here, you can change the colors, set a different prompt from the already available list, etc.

Already available prompt designs listed in Web-based configuration
Prompt Selections

Easier to make changes this way, no?

7. Automatic CD

If you want to move to a directory, you don't need to type the cd command. Just type the directory name, that's it.

For example, if you are in your Home directory and want to move to the Downloads directory, just enter Downloads. As you type, it will suggest further completion as well.

Fish shell can go to a directory, with only the path provided, "cd" command is necessary
Automatic cd

You need to use the absolute path, if you are in a particular directory and want to go to an entirely different branch.

8. Easier path navigation

If you need to go back and forth between the directories you have visited, no need to type in the path or use cd .. etc. Just press ALT + Right/Left arrow, to move forward and backward, respectively.

Navigate through visited directories using ALT key and right/Left Arrow keys
Directory Navigation

Alternatively, you can type cdh and enter, so that a pager interface will come, where you can use the number corresponding to the directory you want to go back to.

Interactively navigate by selecting the corresponding number
Navigation using Pager

You can search for a specific command in history interactively on Fish. For this, use the good old CTRL+R.

This will open a pager like view, with a search prompt. Enter the command name that you need, and see the result:

Interactively search for items in history
Interactive History Search

10. Universal variables

In Fish shell, if you set a variable as Universal, this will be available even if the shell is restarted or even if the system is rebooted.

To make a universal variable, use:

set -U my_variable 10

The value of my_variable will be saved to 10, even if the system is rebooted.

Yeah, no need to add them to your RC or profile.

11. Private Mode

Fish shell has a private mode where the commands you enter will not be saved to the history or stored on the disk.

To move to a private mode, use the command:

fish -P
Private Mode in Fish
Fish Private Mode

Once you have finished your work, you can exit out of private mode by typing exit.

Install and Setup ZSH on Ubuntu Linux
Want a cool looking Linux terminal? Try Zsh. Learn how to set up Zsh on Ubuntu Linux with Oh My Zsh.

There is a lot more to explore with Fish

Fish shell provides many other user-friendly features like:

  • Simple Multiline command edit using ALT+Enter
  • Switch between Emacs (default)/Vim keybindings
  • A simple and clean syntax for scripting

Of course, you can achieve most of the Fish shell features discussed here with some efforts in other shells as well, but having them enabled by default is a different thing.

Fish could help you be a bit more productive and effective with your development work, given that you are controlling your development environment. Don't write scripts exclusively for Fish shell that others have to run in Bash. Shell compatibility issues may arise in a shared environment on a multi-user system.

If you liked the features, give Fish shell a try and see how it goes. Maybe you'll change Fish as your default shell.

Even if you don't want 'Fish' in your terminal, you may like (ASCII) aquarium πŸ˜‰

Using Asciiquarium for Aquarium in Linux Terminal
Here’s a tiny CLI tool to add an aquarium in your Linux terminal.

πŸ’¬ Please share your views on Fish shell in the comments πŸ˜„

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries πŸ•΅οΈβ€β™‚οΈ

It's FOSS

Making You a Better Linux User

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.