Review of Friendly interactive shell (fish) and why it is better than bash

Recently, the administrator of the company I work for advised trying to replace the standard bash with zsh or fish . I started looking for information on both shells before trying them out.

It should explain why I do not like bash. The main disadvantage for me is the bash script. When you need to implement something simple, the syntax is pretty clear. But as soon as you need to make some kind of complex logic (at least a few commands in a row), it becomes very difficult to understand the code, especially when you watch someone else's script. The next thing that upset me was the difficulties in the autocomplete and the search for teams. Of course, the combination Ctrl + r saved, but I wanted this search to be by default. Well, there remained a purely individual dissatisfaction with the color setting in the bash. The only thing I managed to set up was a hint, and even without the PS1 online generator it would be very difficult for me to do this.

Dissatisfaction with all these shortcomings has slowly ripened in me over the past 2 years (I use the command line about as much). I decided to look for alternatives. Having opened "Habr" (the main source of useful information for me), I began to study articles on both shells. The first thing that caught my eye was just one short article about fish . Whereas about zsh there was quite enough information. Having studied the last shell superficially, I realized that it is even more difficult to learn than bash. Of course, anything can be learned and used to the fullest, but I am not a system administrator, but a Python web developer and I need a convenient tool that would not distract from the main work, it was easy and clear to configure, and of course it was pleasant to the eye.


If you are interested in the fish shell , I ask for a cat.

The only Russian language fish manual I found here .

Short list of advantages

  • Interactive mode of operation and user friendliness;
  • Detailed and accessible information about the commands makes their search much easier than in the bash shell man pages. And even if fish cannot connect to the X server, the links browser will be used to display the help;
  • Syntax highlighting: when entering a command, the letters are highlighted in red, and change it to green if the command name is spelled correctly;
  • The names of existing folders are underlined;
  • There are tabs and history;
    It is enough to dial 192 and press the up arrow to scroll through the command line all the ever executed commands where this fragment of the address appeared.
    If you start typing the command from the beginning, you will immediately be offered a continuation from the command that has already been executed, the arrow to the right and the whole team is ready to launch. Thanks avas for the tip
  • Fish uses specific script constructs that are easier for novice users;
  • Autocompletion here is better than in bash, as fish can add options;
  • Easy to read features
  • Easy to configure in the browser using the fish_config command.

These are just the main advantages of fish .

I would also like to write about the differences between these two shells
  • Aliases are replaced and supplemented with functions, which makes fish very flexible and easily customizable, unlike bash;
  • Configuration files are located in the .config / fish folder and are divided into types. For example, the function responsible for displaying the prompt is in the file ~ / .config / fish / functions /, you can write your functions as separate files in the functions folder or all in one ~ / .config / fish / file (I use the latter option, since it is easier to transfer one file, for example, to a working machine).


Ubuntu like distributions:

sudo apt-get install fish

Before this, you can add ppa for version 2.1.1 (in turnip version 2.0.0):

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update

I also use Arch, so I will give a command for it too:

sudo pacman -S fish

Tooltip Differences

I was pleasantly surprised by the display of the prompt in fish . The screenshot above shows that in addition to displaying time, the tooltip displays the full path to the current directory, only shortened to the first letters. This is extremely convenient, you do not have to constantly call pwd. Also a very nice feature is that fish can be configured so that if there is a .git folder in the current directory, then the active branch (committee in the screenshot) is displayed in the tooltip. The best part is that you can only set up a hint by selecting in fish_config in the prompt tab, Classic + git and that's it. I just added to this function the display of time and color to my liking.

useful links

Arch wiki site - very detailed about setting up fish
Rus. man

Request for errors to send in PM, I will try to quickly fix it.

If you have questions, ask in the comments. I will be happy to answer.

Also popular now: