Interact with this post using Mastodon or
Why not another shell?
Published on
Ok, so this blog at time of writing has two categories that are too often subjected to trolling or opinionated views. Indeed some people like to entertain sterile fights between vim
and emacs
, and zsh
and fish
.
So before starting writing here why I chose zsh
over all other shells, I’d like to reiterate that my words only reflect my sole experience and all views exposed here are subjective. No tool is king and people who use some tools are not superior to others. GNU/Linux suffers from few people who like to irrationally promote some distros or tools but the fact is that this OS is the only one to offer its users such variety of tools from which users can built the perfect machine for their specific needs. Even better, you can customize these tools to make them even more suitable to your needs. As a consequence, each user will have a unique combination of tools with unique configurations.
That out of the way, let’s talk about zsh
or about why I did not go with the other shells out there.
╭── Shells
If bash
is still the default shell, a lot of other ones have been developed over time. Here is a quick list of some of them:
– POSIX-compliant shells:
- bash (Bourne shell)
- zsh
- dash
- ksh
- osh
- yash
– Other shells:
- fish
- tcsh
- elvish
- ion
- nash
- nushell
- oh
The POSIX categorization is the most used one because this is the first thing you’d consider when choosing a shell. In simple words, being POSIX compliant will ensure scripts portability.
Before sticking with zsh
I’ve tried some other shells: dash
, ksh
, and fish
in that order.
First observation is that fish
is the only non POSIX-compliant shell in this list and I realized that POSIX compliance was important to me.
╭── Why not fish?
fish
and zsh
are in the top list of used shells.
fish
has a unique command-line syntax that’s designed to be a bit easier to learn, but isn’t derived from either the Bourne shell or C shell. It is intentionally not fully POSIX compliant as it aims at addressing POSIX inconsistencies (as perceived by the creators). This means that even simple POSIX compliant scripts may require some significant adaptation or even full rewriting to run with fish
. So behind an interesting idea, what you learn through using fish
will not necessarily help you use other Bourne-derived shells.
fish
is usually presented as offering more features than any other shell and that’s… right… out of the box. fish
comes fully featured and that’s great if you want something that can tackle all your needs by default. The problem is that I don’t like easy things (joke inside). When choosing a distro or any tool I like to go with something pretty bear bones but with high potential for customization so I can built from scratch a system that will perfectly fit my needs - no more, no less. This is a more time consuming approach but I’ve learnt a lot from tweaking tools I use today.
In conclusion, while fish
is a great shell, it offered “too much” for me out of the box and was not POSIX-compliant which was a real issue for my personal use. So, I had to find another shell.
╭── zsh
: the vim
-like shell?
When you start using zsh
you may quickly face some limitations because it’s a very minimal shell by default. Thanks to a wonderful community, you can very easily unlock some features by tweaking the vim
configuration or by adding plugins. In that sense, zsh
feels to me very similar to vim
.
If you consider all the features available to you in zsh
, you can end up with something at least similar to fish
.
Looking at the main difference reported online between fish
and zsh
, you’ll notice that fish
is often known for:
- speed:
fish
is apparently known to be faster thanzsh
. As a human who run simple commands I can’t appreciate a few milliseconds difference so I’ll blindly trust thefish
speed advantage but I can’t tell it would affect my daily usage - autosuggestion: this is actually also available in
zsh
and (like infish
if I’m not mistaken) you can even use colors to highlight commands and paths to let you know if they exist or not - simplicity: I’ve talked about that earlier.
zsh
indeed requires some configuration to unlock the features you’d like to use but I would honestly not consider that difficult to achieve at all, and I’m personally willing to spend some time as a cost for customization and flexibility.
Also, I like the availability of a vim and an emacs mode that let you use the default motion keybindings from your preferred editor in the terminal.
In conclusion - and that should almost be at the end of all my posts - the best way to know what you need is to experiment. It will cost you time at first but you will then save 100 times more time when using the right tools for you. A lot of simplified tools comparisons are biased and/or only limited to the default features/options offered by a program.
Thanks for your read. Hope it's been useful to you.
✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈
More food for thoughts? Check other posts about: #Zsh