Shell Comparison: Analyzing the Pros and Cons of Bash, Zsh, Fish, and Tcsh

Alan
NTUST-AIVC
Published in
6 min readMar 23, 2023

Helping you decide which shell to use!

Before we begin comparing various shells, if you’re not sure what a shell is, you can take a look at this article written by Ted, which explains what a shell is.

What is “Bash” ?

Bash logo. Click here to visit the official website for bash.
Bash’s author Brian Fox.

Bash is a Unix shell and command language, written by Brian Fox for the GNU Project and first released in 1989. It is one of the most well-known packages in the GNU software collection, maintained by the Free Software Foundation (FSF).

As the default shell for most Linux distributions, it is an open-source shell. It supports command history, command completion for file paths, variables, and commands. It also supports wildcards such as *, ?, and colored directory listings, text highlighting, directory history, stack or similar features, implicit directory change, value prompt, progress indicator, and option prompt. However, it does not support mandatory argument prompt, automatic suggestions, syntax highlighting, autocorrection, an integrated environment, snippets, context-sensitive help, or a command builder.

Actually, bash can also use some of the unsupported features mentioned above, but it requires additional installation, and its configuration and extension are not as simple as zsh or fish.

The syntax of Bash commands is a superset of the Bourne shell command syntax.

What is “Zsh” ?

Zsh logo. Click here to visit the official website for zsh.

Zsh was initially written by Paul Falstad in 1990 at Princeton University. The name ‘zsh’ originates from the login-id of Zhong Shao, a professor at Yale University (then a teaching assistant at Princeton), which Paul Falstad regarded as a good name for a shell. Zsh is designed for interactive use, it is also a powerful scripting language. Many useful features of Bash, Ksh, and Tcsh have been incorporated into Zsh.

Currently, it is the default shell for both Mac OS and Kali Linux, and it is also an open-source shell. It comes with “oh my zsh,” which can help with plugin installation and theme customization. Both plugins and themes can be found on the official website.

Its syntax is very similar to Bash, but its configuration and extension are easier than Bash.

What is “Fish” ?

Fish logo. Click here to visit the official website for fish.

Fish is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family.

It was a shell released by Axel Liljencrantz in 2005. Fish is short for “the friendly interactive shell”, and its biggest feature is its convenience and ease of use. Many other shells require configuration for certain features, but Fish provides them by default without the need for any configuration.

It is the default shell for GhostBSD, and it supports fewer interactive features than zsh. It does not support mandatory argument prompt, context-sensitive help, command builder, and progress indicator.

It is a very unique shell, and its syntax differs significantly from zsh and bash. This can make it difficult for Fish users to share scripts with bash or zsh users.

Additionally, since most Linux systems currently use bash, using Fish can make collaborative development more difficult.

What is “Tcsh” ?

Image of tcsh. Click here to visit the official website for tcsh.

The “T” in Tcsh comes from the “T” in TENEX, which was an operating system that inspired Ken Greer, the author of tcsh at Carnegie Mellon University. He created the C shell — tcsh — with features such as filename completion and command-line editing, and it was released in 1983.

It is the default shell for FreeBSD, supporting fewer interactive features than bash, including wildcard, mandatory argument prompt, automatic suggestions, syntax highlighting, integrated environment, snippets, option prompt, context-sensitive help, and command builder.

The syntax is the same as the C shell, so users of the C shell can easily transition to using it.

Here we will briefly introduce the supported and unsupported interactive features. For those who are unclear or interested in these interactive features, please refer to the following website.

One important point to note is that most Linux scripts found online are based on the Bash shell, which is very convenient for users of Bash and Zsh. However, this is not the case for Fish and Tcsh users.

Command comparison

There are too many commands in the shell, so here we will pick some of the most commonly used commands for comparison.

  1. alias or abbr (Command Abbreviation)

When working on a shell, some commands are too long and using abbreviations can make the shell more efficient. “alias” is used to create shortcuts in Bash, Zsh, and Tcsh. But in Fish, “abbr” is used to create shortcuts.

Here, we set “alan” as the abbreviation for “ls -a” command.

The “alias” command in Bash
The “alias” command in Zsh
The “alias” command in Tcsh

Fish’s abbreviations automatically expand into the original commands after input. Here, we use “abbr -e” to remove the abbreviation and confirm its existence.

The “alias” command in Fish

2. math or expr (Mathematical operation)

In the world of programming, mathematical operations are indispensable. In bash, zsh, and tcsh, we use the “expr” command to perform mathematical operations.

The “expr” command in Bash
The “expr” command in Zsh
The “expr” command in Tcsh

In fish, we not only have the “expr” command for performing mathematical operations, but also a “math” command that can do exactly the same thing.

The “expr” and “math” command in Fish

Different commands in different shells do not necessarily make one shell inferior to another. It simply means that we need to adapt to the different ways of using commands.

Execution speed comparison

The execution speed of a shell can affect the user experience when using a program. A faster shell can provide a smoother experience for users.

Here, we will execute a program that runs a loop 100,000 times to compare the execution speeds of different shells.

Execution speed comparison

The syntax of bash and zsh is compatible, and the same program can be used directly. Fish and tcsh have their own syntax, and the same program needs to be adapted to their respective syntax in order to be used.

It can be seen that the execution speed is zsh > bash > tcsh > fish.

The execution speed of a shell has little impact on small programs, but when using large programs, it is necessary to consider which shell to use.

In this article, we compared four shells. However, there are many other shells in the world. If you are interested in the four shells we introduced, you can go to their respective official websites for further information. You can directly click on the shell logo above to link to their official websites.

Hi there! Nice to meet you. I’m Alan, the author of this article. This is my first time writing an article, so if there are any mistakes, please feel free to message me directly. I hope we can all have a smooth journey in learning programming. By the way, personally, I think zsh is the most user-friendly to use.

--

--