When it comes to terminal shells, many developers (myself included) have stuck with what they know or what they've seen others use online, without exploring other options.
It's time to venture out and discover the world of terminal shells.
Most developers are likely using Zsh, a POSIX-compatible shell, probably with Oh My Zsh on top. But there's a whole spectrum of shells out there, each with its own strengths and quirks. Today, we're going to explore three major players: Bash, Zsh, and Fish.
The Shell Showdown
- Bash (Bourne Again Shell): The old reliable. It's POSIX-compatible and comes with a scripting language that can be used in executable files or inline in the shell. Bash introduced features like VI mode, which allows you to use Vim-like commands in your terminal.
We all need to know bash in some way; it's everywhere, comes with any server, any linux flavour and a trusted shell to be familiar with when others aren't available.
- Zsh (Z Shell): The popular middle ground. It's POSIX-compatible like Bash but comes with more modern features. Zsh has a thriving community building tools like, Oh My Zsh and "zsh for humans" that add syntax highlighting, autocompletions, and more. There's a great reason Apple made ZSH the default shell recently, and why most developers are running it locally.
- Fish (Friendly Interactive Shell): The new kid on the block. Fish comes with many features out of the box that Bash and Zsh require configuration to achieve. It offers syntax highlighting, autocompletion, and even a web-based configuration interface. The feel around fish is a user-first, experience-in-mind approach to everything, and you owe yourself a try!
"Fish is a Unix-like shell with a focus on interactivity and usability. Fish is designed to be feature-rich by default, rather than highly configurable.
Most people either stick with Bash or switch to Zsh with Oh My Zsh (or get it by default with their machine). While this works, it often requires extensive configuration and doesn't provide the most user-friendly experience out of the box. Why work if you can get so much by installing one simple shell?
Configuring Bash or Zsh to be truly user-friendly can be time-consuming and overwhelming for many developers. Even with tools like Oh My Zsh, there's still a learning curve and potential for bloat.
Consider giving Fish a try.
As Oliver Kiddle, Jerry Peek, and Peter Stephenson note in their book "From Bash to Z Shell: Conquering the Command Line", each shell has its strengths, but Fish stands out for its user-friendliness and out-of-the-box features.
Fish comes with syntax highlighting, intuitive autocompletion, and web-based(!) configuration by default. It's not POSIX-compatible, which means some scripts might not work directly, but it offers a much gentler learning curve for newcomers and a refreshing change for experienced developers.
Putting It Into Action
- Install Fish on your system (brew install fish / nix-env -iA nixpkgs.fish - pick your poison 👺)
- Try out its features like autocompletion and syntax highlighting without any configuration.
- Explore the
fish_config
command to customize your shell through a web interface.
- Experiment with Fish's scripting language for your shell scripts. This isn't a must though; as long as you keep a bash shabang on your old POSIX scripts, you're good.
Remember, you don't have to switch completely.
You can use Fish for interactive use while keeping Bash or Zsh for scripts that require POSIX compatibility!
By exploring different shells, you'll not only potentially find a more comfortable working environment but also broaden your understanding of command-line interfaces.
Thanks for reading!
Feel free to reply directly with thoughts and questions.
See ya next week...
Whenever you’re ready, here’s how I can help you:
|
|