As a long-time command line user, I have tried out various shell programs. Two that have consistently stood out to me as being particularly powerful and user-friendly are Z shell (zsh) and Friendly Interactive Shell (fish).
I will compare these two programs in this article to help you decide which one might be the best fit. I will cover a range of topics, including the features and functionality of each shell, the installation process, and the community support available.
What is Zsh?
Offering a variety of features and functionality, the Z shell (zsh) is an incredibly customizable Unix shell initially developed in 1990 by Paul Falstad. It can be used as an interactive interface, and its unparalleled capabilities make it ideal for scripting purposes.
With zsh, you can finish commands, file names, and arguments by pressing the tab key. This unique command-line completion system is one of its most noteworthy features. For example, if you are typing a long file path and press tab, zsh will automatically complete the rest of the path.
Another great feature of zsh is its support for aliases, which allow you to create custom abbreviations for commonly used commands. This can save you time and typing, mainly if you use the command line frequently.
In addition to these features, zsh also offers support for command history, command line editing, and a wide range of built-in functions and parameters. It also has a large community of users and developers, which means plenty of resources are available for learning more about zsh and troubleshooting any issues you may encounter.
Related: How to Fix Zsh Permission Denied
What is Fish Shell?
Friendly Interactive Shell (fish) is a Unix shell that was first released in 2005 by the developers at fishshell.com. Like zsh, it is known for being highly user-friendly and customizable, with a range of features that make it well-suited for use as an interactive shell or as a scripting language.
One of the standout features of fish is its syntax highlighting, which makes it easy to read and understand complex command line statements. It also includes auto-suggestions, which provide suggestions for commands as you type them, helping you to avoid mistakes and save time.
In addition to these features, fish also offers support for command history, command line editing, and a wide range of built-in functions and parameters. It has a smaller community of users and developers compared to zsh.
However, plenty of resources are available to learn about fish and troubleshoot any issues you may encounter.
Installation
Now that we’ve covered each shell’s basic features let’s talk about the installation process. Both zsh and fish are available on most major Linux distributions and macOS. Here’s a brief overview of how to install each shell on these platforms:
Installing zsh on Linux
If you are running a Linux distribution, you can typically install zsh using your package manager. On a Debian-based system (such as Ubuntu), you can use the following command:
sudo apt-get install zsh
On a Red Hat-based system (such as CentOS or Fedora), you can use the following command:
sudo yum install zsh
Installing fish on Linux
To install fish on a Linux distribution, you can use the same process as above, substituting “fish” for “zsh.” On a Debian-based system (such as Ubuntu), you can use the following command:
sudo apt-get install fish
On a Red Hat-based system (such as CentOS or Fedora), you can use the following command:
sudo yum install fish
Installing zsh on macOS
On macOS, you can install zsh using the Homebrew package manager. First, make sure that you have Homebrew installed by running the following command:
brew -v
If you don’t have Homebrew installed, follow my step-by-step guide.
Once you have Homebrew installed, you can install zsh by running the following command:
brew install zsh
Installing fish on macOS
To install fish on macOS, you can use the same process as above, substituting “fish” for “zsh.”
brew install fish
Configuration
Once you have zsh or fish installed, you will likely want to customize your shell to suit your needs. Both zsh and fish offer a wide range of options for customization, including the ability to change the appearance of the command prompt, set environment variables, and create custom aliases and functions.
Configuring zsh
In zsh, you can customize your shell by editing the .zshrc
file in your home directory. This file contains a list of commands and settings that will be executed every time you start a new zsh session.
To make changes to your zsh configuration, you can edit the .zshrc
file directly or use the zsh-config
tool. To use the zsh-config
tool, run the following command:
zsh-config
This will open a menu of options that you can use to customize your zsh configuration. You can use the arrow keys to navigate the menu and the enter
key to select an option.
Configuring fish
In fish, you can customize your shell by creating a configuration file called config.fish
in the ~/.config/fish
directory. This file contains a list of commands and settings that will be executed every time you start a new fish session.
To make changes to your fish configuration, you can edit the config.fish
file directly or use the fish_
config tool. To use the fish_config
tool, run the following command:
fish_config
This will open a menu of options to customize your fish configuration. You can use the arrow keys to navigate the menu and the enter
key to select an option.
Community Support
One of the key considerations when choosing a shell is the level of community support available. Both zsh and fish have active communities of users and developers, which means plenty of resources are available for learning more about these programs and getting help with any issues you may encounter.
Zsh community support
The zsh community is large and active, with several resources available for learning more about the shell and getting help with any issues you may encounter. These resources include:
The official zsh documentation provides detailed information about the features and functionality of zsh, as well as instructions for using and configuring the shell.
- The zsh mailing list is a forum for discussing zsh and getting help with any issues you may encounter.
- The zsh IRC channel is an online chat room where you can ask questions and get help from other zsh users and developers.
- The zsh community forums are online forums where you can ask questions and get help from other zsh users and developers.
In addition to these resources, many online tutorials, blog posts, and articles are available that cover a wide range of topics related to zsh.
Fish community support
The fish community is smaller than the zsh community. However, several resources are still available for learning more about the shell and getting help with any issues you may encounter. These resources include:
- The official fish documentation provides detailed information about the features and functionality of fish, as well as instructions for using and configuring the shell.
- The fish mailing list is a forum for discussing fish and getting help with any issues you may encounter.
- The fish IRC channel is an online chat room where you can ask questions and get help from other fish users and developers.
- The fish community forums are online forums where you can ask questions and get help from other fish users and developers.
In addition to these resources, several online tutorials, blog posts, and articles are available that cover a wide range of topics related to fish.
Comparison
Now that we’ve covered each shell’s basic features and functionality let’s take a closer look at how they compare.
Features
Both zsh and fish offer a wide range of features that make them well-suited for use as interactive shells or scripting languages. Some of the standout features of each shell are listed below:
Zsh
- Powerful command line completion system
- Support for aliases
- Command history support
- Command line editing
- Built-in functions and parameters
Fish
- Syntax highlighting
- Auto-suggestions
- Command history support
- Command line editing
- Built-in functions and parameters
As you can see, both shells offer a similar set of features, with a few key differences. Zsh is known for its powerful command line completion system and support for aliases, while fish is known for its syntax highlighting and auto-suggestions.
Customization
Both zsh and fish offer a wide range of options for customization, including the ability to change the appearance of the command prompt, set environment variables, and create custom aliases and functions.
Community support
As mentioned earlier, both zsh and fish have active communities of users and developers, so plenty of resources are available to learn about these programs and get help with any issues you may encounter. The zsh community is larger and more established, while the fish community is smaller but still active.
Zsh vs Fish Comparison Table
Feature | Zsh | Fish |
---|---|---|
Command line completion | Yes | Yes |
Aliases | Yes | Yes |
Syntax highlighting | No | Yes |
Auto-suggestions | No | Yes |
Command history support | Yes | Yes |
Command line editing | Yes | Yes |
Built-in functions and parameters | Yes | Yes |
Community support | Large and active | Small but active |
Conclusion
Both zsh and fish are powerful and user-friendly shells that offer a wide range of features and customization options. The best shell for you will depend on your personal preferences and needs.
If you are looking for a shell with a powerful command line completion system and support for aliases, zsh might be the better fit for you. Fish might be better if you prefer a shell with syntax highlighting and auto-suggestions.
Ultimately, the best way to decide which shell is right for you is to try them out for yourself. Both zsh and fish are easy to install and configure, so you can experiment with each one and see which one you prefer.