Exploring the Fish Shell
Exploring the Fish Shell: Why It’s My Favorite Interactive Shell
If you work in IT, you’ve probably tried your fair share of shells: Bash, Zsh, maybe even some others which i’ve never used like Tcsh or Dash. For me, though, the Fish shell stands out, and I’d like to share what makes it my favorite, especially for everyday interactive use.
One of the features that immediately drew me to Fish is its Auto Suggestions. As soon as I start typing a command, Fish automatically suggests a matching command I ran recently. These suggestions appear in a light grey color, allowing me to decide if I want to press the right arrow key to accept the suggestion or continue typing if I prefer a different command. It’s like having a personal assistant that remembers my previous commands, helping me save time while working in the terminal.
Key Features I Love About Fish Link to heading
There are several features that come with Fish out-of-the-box that enhance my workflow, and I find myself using them daily:
-
Auto Suggestions As I mentioned before, Fish’s Auto Suggestion feature is a game-changer. It’s not just about offering suggestions as you type—it remembers your history and tries to match what you’ve typed before.
-
List Command attributes you can list all available attributes (options) for a command by pressing
Tab
after typing the command partially, but you need to ensure that you provide a valid placeholder to trigger the options display. This is one of Fish’s powerful features for easy and efficient command-line navigation. -
Syntax Highlighting Fish gives immediate feedback on syntax errors with syntax highlighting. As I type a command, Fish highlights the syntax in real-time. If I make a mistake (like an incorrect command, unmatched quote or a wrong operator), the shell will immediately highlight the issue in red, making it easy to fix before I even run the command. This feature has saved me countless hours of debugging.
-
Abbreviations Fish allows you to create abbreviations that expand into full commands. For example, I can create an abbreviation gco for git checkout, and whenever I type gco followed by a space, Fish automatically expands it to git checkout. This feature is great for speeding up repetitive tasks, and the best part is, it works without having to write any scripts or modify external files. I simply use the abbr command to create and manage them.
gco #Press Space #Converts to git checkout
-
History Fish makes working with my history much easier. When I press the up arrow, I don’t just get a list of past commands—I get a full history search with easy-to-read timestamps and command descriptions. Fish’s history management is more intuitive than other shells, and it even supports searching through history interactively by typing part of the command. For eg: write
ps
and press up arrow would give the last command which used ‘ps’ -
Shows the Git Branch The Fish shell display the current Git branch in the prompt out of the box without any additional configuration required. Fish automatically detects when you’re inside a Git repository and shows the current branch name in the prompt.
What’s Different and What I’m Still Getting Used To Link to heading
Although Fish has many features that I love, there are still a few things that trip me up, especially coming from a long history of using Bash and Zsh.
-
Bash Scripts require tweaks One of the things I’ve found when transitioning to Fish is that many Bash scripts I find online are not directly compatible with Fish. While Fish is an amazing interactive shell with a lot of powerful features, it does not always play nicely with scripts written for Bash or other shells. For example, many internet-sourced Bash scripts assume you’re using Bash’s syntax for things like setting environment variables or running loops.
So, while Fish is compatible with many tools and commands, scripts designed for Bash are not 100% plug-and-play. They often need to be tweaked for Fish’s syntax, and while this is manageable for most users, it can be a bit of a hurdle if you rely on pre-written scripts from the internet.
That said, Fish does offer an easy way to work around this issue by using a bash command to execute a Bash script in its native environment. But if you’re looking for a seamless experience where everything just works, you may run into some bumps along the way.
-
Scripting Muscle Memory I really enjoy using Fish as an interactive shell. It’s fast, intuitive, and rich in features for daily command-line work. However, when it comes to writing shell scripts, I still find myself relying on Bash or Zsh due to muscle memory. While Fish can handle scripting just fine, its syntax can feel a little different than what I’m used to, especially for more complex scripts. Some people might find Fish’s scripting environment a little restrictive, but for me, it’s just a matter of comfort.
Can You Get These Features in Zsh? Link to heading
Let me be clear—Fish is far from the only shell with these features. Zsh, with the right plugins, can offer Auto Suggestions, syntax highlighting, and even man-page completions. However, one of the things I love about Fish is how much of this functionality is built in by default. You don’t have to spend time setting up plugins or tweaking configurations to get these features working. It just works, right out of the box.
Conclusion Link to heading
Overall, Fish has quickly become my go-to shell for interactive use. From its slick Auto Suggestions to its intelligent man-page completions, syntax highlighting, and user-friendly abbreviations, it’s a shell designed for speed and efficiency. While I’m still getting used to a few differences, particularly when it comes to scripting and setting variables, Fish has fundamentally changed the way I interact with my terminal.
If you’re someone who spends a lot of time in the terminal and values productivity, I highly recommend giving Fish a try. Its unique features and user-friendly design make it a joy to use, and with minimal setup, you’ll quickly be reaping the benefits.