7 Reasons Why You Should Install The Fish Shell
Perhaps what drives so many people to install Linux is that it’s so ridiculously customizable. If you don’t like how it looks, you can just install a new windowing environment . If you don’t like how your terminal works, you can change that by installing a new shell.
There are a lot of different shells you can choose from. One of the most popular is bash, but there’s also ZSH, Korn Shell, and TCSH. They are all fine shells, but they were all created in the 1970s, 1980s, and early 1990s, and they haven’t really moved with the times. Which is why you should consider trying fish – the Friendly Shell.
Fish has the slightly ironic tagline of “a command line shell for the 90s”. It introduces features that really should have became commonplace sooner, but didn’t. Features like autosuggestions, VGA colors, and a scripting language inspired by modern programming languages like Python and Ruby. I’m a fan.
Read on to find out what fish can do for you, and how you can install it on your machine.
Autocomplete and Suggestions
One of fish’s best features is autocompletion. It knows what you’re thinking, and will gladly save you the keystrokes by finishing your command for you. Just press Tab.
Although it’s an innovative feature, at least as far as terminal shells go, it’s not all that complicated. It makes its assumptions based upon a combination of guesswork, and your command line history.
If you get stuck on a given command, pressing the Tab key will list all known acceptable parameters, and what they do. This is done by fish gleaning through the “Man Pages” (documentation, essentially) of that particular program.
Syntax Highlighting and Beautiful Colors
I know; you can customize other shells to use more vibrant colors, and to have syntax highlighting. But fish has it right out of the box, and has a much broader palette of shades to choose from.
Not only does this make things much more readable, but it looks really pretty. In my own experience, I’ve found this has markedly improved my accuracy on the timeline, as I’m less inclined to write malformed commands.
Another cool feature that fish has is the ability to use wildcards anywhere you feel like. So, how does that work?
Well, if you’re using Bash, and you run “ls *.txt”, you’ll get an error message because it’s looking for a specific file called “*.txt”. Not in fish.
As you might expect, it’ll list everything in the given directory that has a file extension of “.txt”.
You can also have multiple wildcards too. So, if you run “ls *.jp*”, you will list every file that has an extension that starts with “.jp”. That’s extremely helpful when you consider that JPEG files can come with both “.jpg” and “.jpeg” extensions.
Another novel feature of fish is that it can be configured through a web interface, running on a local web server. This is pretty much the only shell that offers this. While this sounds like a bit of a “white elephant” feature, it really isn’t.
The web interface allows you to adjust the color scheme to your liking. Although, I must admit, I was pretty happy with the default palette.
Fish’s web configuration tool also lets you browse your environment variables , all through the comfort of your own web browser.
Other things that can be adjusted through the web configuration tool are the terminal key bindings, the aesthetic of the command prompt, and the default functions available through Fish’s scripting language.
Finally, you can also see your command line history. This is extremely helpful when you need to walk through the steps you took in order to solve a head-scratchingly difficult problem.
Let’s touch on another advantage of fish. Much like you can in bash, fishlets you use semicolons and combiners to chain commands together. This lets you have some kind of rudimentary flow control when you’re writing handy little one-liners.
The difference is that fish looks good while doing it. It replaces the logical operators used by bash ( “||”, “&&”, and “!”), and replaces them with “and”, “or”, and “not”. This makes it way more readable.
Helpful Error Messages
This is my favorite feature of fish. Whenever you (inevitably) screw up, fish will explain in plain-English where you went wrong, and more importantly, how you can fix it.
I don’t know of any other shell that has error messages that are as clear.
It’s Easy to Install Fish
Convinced? I thought so. Now we’ll get to the part where I explain how to install it.
First, you’re going to need to grab a copy from fish from the repositories of your chosen Linux or BSD distribution. On Ubuntu and Ubuntu-like distributions, that’s just “sudo apt-get install fish”.
If you’re on a Mac, you can install it through HomeBrew . It’s worth noting that if you’ve recently upgraded to El Capitan, HomeBrew might be broken. You can follow these steps to fix it. Also, if you’re using Windows, there’s a version for Cygwin.
You can immediately start using fish by typing “fish” into your command prompt and pressing return. The problem is, it’ll only be active for that particular session. If you close your terminal and reopen it, it’ll display the shell you used previously. That’s probably bash.
So, you need to set fish as the default shell. To do that, just run “chsh -s /usr/bin/fish”, and restart your terminal. If you run into any trouble, this AskUbuntu thread is especially enlightening.
When I tried to install it on my Mac, I got an error that said “non-standard shell”. I was able to fix this by editing /etc/shells/ using the VIM text editor , and adding the path to fish on a new line.
Swimming With The Fishes
Has fish tempted you to change your shell? Are you going to stick with plain-old bash? Or do you use some other kind of exotic shell? Let me know in the comments section below!