The shells you hear about the most, like bash, tcsh, and zsh aren’t the only shells out there. For about 5 years, I’ve used a shell called fish. While the community of people using it is quite small, it’s a passionate group and the shell has some features you’ll wonder how you lived without.
You can download it here.
The cheeky headline on the pages pokes fun at other shells. The documentation is excellent and worth perusing.
I like to describe it as the Apple of shells. Even though it’s possible to get many fish features in other shells, it typically involves many trips to Stack Overflow or borrowing people’s shell files. The fish shell tends to make these the default or make it easier to set them up.
- Many of the common things people want are enabled by default, like case-insensitive completion on the command-line
- Tab-completion is simply amazing
- Shell parameters can configured in a web interface
- Support for functions with easy syntax
I’d like to call out tab completion as this is my favorite feature and is typical of fish. Here’s are a couple of examples.
Just like other shells, before you type anything, hit the up and down arrow keys and note you get your command history like in other shells.
Now type rm and note it completes to you last use of the rm command. Now, when you arrow up and down, you only see a history of rm commands you typed. Awesome.
Take it further and type rm -rf and arrow up and down to narrow it further.
Take it further and type rm -rf ~/Library and arrow up and down and see only uses of rm -rf in your infinite history.
Other shells can be configured to do case insensitive completion, but fish does it out of the box. Saves you that extra time reading Stack Overflow.
In fish, you can also type part of a filename that is not necessarily the beginning and it will complete based on that. One great example of this being useful is you go into an Xcode project directory. You can do open xcode<tab> and it will complete to one or mode xcodeproj files.
Case insensitivity combined with subset completion means more completion and less beeping on the command line when you hit Tab.
- Using other machines that don’t have the shell involved can be a pain
- bash commands typed on the command-line may not work – you’ll have to type “bash” to switch first
- The web configuration UI is cool, but a bit flaky