Recently, the admin of the company in which I work, advised to try to replace the standard bash with zsh or
fish . I started looking for information on both shells before trying them.
It should explain why I do not like bash. The main inconvenience for me is the bash script. When you need something simple to implement, the syntax is pretty clear. But as soon as you need to make some complicated 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 is the difficulties in autocomplexing and searching for commands. Of course, the combination Ctrl + r saved, but I wanted this search to be the default. Well, there remained a purely individual dissatisfaction with the setting of colors in the bash. The only thing I managed to set up was a hint, and it would have been very difficult for me to do that without the online PS1 generator.
Dissatisfaction with all these shortcomings has slowly matured in me over the past 2 years (approximately as much as I actively use the command line). 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. After examining superficially the last shell, I realized that it is even more difficult to assimilate than bash. Of course, anything can be learned and used in full, but I'm not a sysadmin, but a Python web developer and I need a handy tool that would not distract from the main work, be easily and
understandably tuned, and of course it was pleasant to the eye.
')

If you are interested in the shell
fish , please under the cat.
The only Russian-language manual for
fish I found
here .
Short list of benefits
- Interactive mode and user friendliness;
- Detailed and accessible information about the commands makes searching for them much easier than in the bash man pages. And even if fish cannot connect to the X server, the links browser will be used to display help;
- Syntax highlighting: when entering a command, the letters are highlighted in red and change 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 as in the command line all ever executed commands will scroll where this piece of the address appeared
If you start typing a command from the beginning, you are immediately offered to continue from the command that has already been executed, the arrow is to the right and the whole team is ready for launch. Thanks avas for the tip
- Fish uses specific script constructs that are easier for novice users;
- Autocompletion is better here than in bash, as fish can write options;
- Easy to read function view;
- Easy to configure in the browser using the fish_config command.
These are only the main advantages of
fish .
I would also like to write about the differences between these two shells
- Aliases are replaced and added with functions, which makes fish very flexible and 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 tooltip is in the file ~ / .config / fish / functions / fish_prompt.fish, you can write your functions as separate files in the functions folder or all in one file ~ / .config / fish / config.fish (I use the latter option, since it is easier to transfer one file, for example, to a working machine).
Installation
Ubuntu like distros:
sudo apt-get install fish
Before this, you can add ppa for version 2.1.1 (in turnips version 2.0.0):
sudo apt-add-repository ppa:fish-shell/release-2 sudo apt-get update
I also use Arch, so I'll give the command for it as well:
sudo pacman -S fish
Differences in tips
I was pleasantly surprised by the display of tips in
fish . From the screenshot above you can see that in addition to displaying the time, the tooltip displays the full path to the current directory, only shortened to the first letters. This is extremely convenient, do not constantly call pwd. Also, a very nice feature is that
fish can be configured in such a way that if there is a .git folder in the current directory, the tip shows the active branch (committee in the screenshot). Best of all, you can customize the hint just by selecting in the fish_config tab of the prompt, Classic + git and all. I just added to this function the display of time and color to your liking.
useful links
Of siteArch wiki - very detailed about setting
fishRus mansconfig.fishfish_prompt.fishPlease send errors to the PM, I will try to fix it promptly.
If you have questions - ask in the comments. I am happy to answer.