Linux Applications

FISH – The helpful shell

FISH aims to have the entire manual at your fingertips to a much higher degree than the other shells. The main idea is to help you learn what you can do. Many people will have a lot of use of this but hardcore users may have objections because of performance. It also blocks some regular functions. With this in mind, consider having fish in your toolkit when you are using new functions.

Installing fish in Linux

You install fish with your package manager, if you have more advanced needs checkout our article How to Install Fish Shell.

In Ubuntu, you would use apt this way.

$ apt install fish

After you have it installed, start using it as you would bash. While typing, you will see more suggestions than ever, try the tab key to get more out of fish.

What is special about FISH?

Before you have configured anything, you will see that the prompt is little changed. After you type a few commands, you will soon notice that you get a lot of help as you type. If you start using scripts, you may notice some incompatibilities. In fish, you always get suggestions for commands. If there are many, you get hints about each.

You have many more options, including creating functions. Just like in the other shells, you can set your prompt to look the way you want. Your system configuration files are in usr/share/fish, they are in a tree. As you can see from the below picture.

From the tree, you can see the main directories; completions, functions and tools. You can copy and fill these directories with files but you also have a web-based way to create them. Until you are writing your own functions, use the default ones to set your shell.

How can you tweak it?

As you saw earlier, you have many directories to tweak your shell. You can not use all bash scripts for this, there are compatibility issues. The good news is that the format is very simple and you can use Python, if that is your cup of tea.

Until you get that advanced, you may want to choose from the community contributed functions. One way to configure is to use the web-based system. To start that, you run the below command while in fish.

$ fish_config

This command starts a small web server and calls your default web-browser. The page is a simple tabbed page that contain the functions you may need or want. Here is a picture.

Running FISH configuration

When you pick a tab, there are many options below. When the style is viewed you can just click ‘Set Theme’ and the file is added under your username configuration files. This tool covers seven setting groups, theme and prompt are two first ones. This tool is handy for getting started and borrowing code from others. It is easy to use the code in your own configuration and adjust. Since you are a genius, contribute your final tools and settings to the repository. An important note is that the prompt and aliases are replaced with functions. The prompt function is named ‘fishprompt’ and all functions have a name that acts as an alias. You can check out what you have with the functions command.

$ functions

To add a function, you need to write a script that does what you are trying to achieve. A simple example is below.

function gp
command git pull $argv

With a simple function like this, the likeness to aliases is apparent but a function can contain much more than this. The functions are global so when you run create a function it has to have another name than any other in fish. You can have one file (.config/fish/ or in separate files under the functions directory. The name of the function must still be unique because fish has only one name space. Another important detail is that you must use the ‘$argv’, otherwise you cannot use any parameters to your command.

The files that exist in (~/.config/fish/functions/) directory will be auto loaded by fish. You can also create a new function by using the ‘function’ command.

$ function cool

The cool function now exists in your current session. You can edit with ‘funced cool’ to make it work the way you want. The editing happens directly in the shell. The only odd thing is that to add new lines, must use Alt-Enter to save the function. To save, you use the ‘funcsave’ command. The result ends up as a file named ‘’ in this case, in the functions directory.

$ funced cool
$ funcsave cool

When you have that file, you can use your favourite editor to make more advanced changes.

If you want to have more detailed information, the fish cookbook is a great resource.


Fish is a very powerful shell that can help users in their endeavours on the command line. If you feel that you still need the manual a lot, you can use fish to help you be faster. The most common shell in Linux is bash, which can be used for anything you need but fish can help you develop yourself faster. It is also easier to create new functions that suite your needs. This shell is more actively helping, whether you want that or not is totally up to you.

About the author

Mats Tage Axelsson

I am a freelance writer for Linux magazines. I enjoy finding out what is possible under Linux and how we can all chip in to improve it. I also cover renewable energy and the new way the grid operates. You can find more of my writing on my blog.