Most system administrators who work with Linux know that the command line shell is the best way to quickly get work done and to write scripts that tie together the many command line tools that make Unix-derived operating systems so flexible and powerful.
By far the most popular shell is Bash, which is the default in many distributions. Developed under the aegis of the Free Software Foundation as a replacement for the Bourne shell, the Bourne-again shell is the command line interface that most Linux users are familiar with. There are, however, many alternatives that users might want to try out. Some of them extend the capabilities of Bash in some way, and all of them were developed to scratch some itch that the developer had. It’s definitely worth being aware of the options and how to try them out, so we’re going to have a look at 5 of the most popular alternative shells for Linux.
We’re limiting this article to alternative shells, so we’re not going to be looking at tools like BusyBox, which aims to be a comprehensive command line environment, including versions of most of the tools that usually run on top of a shell.
Unless you’re running a Debian derivative, you’ll almost certainly be using Bash by default. Most of the alternatives we’re going to suggest can be easily installed using your distribution’s package manager, but we’ll also provide links to the project pages in case you want to grab the tarball and compile yourself.
Once installed, the simplest way to test out a new shell is to simply run it from the command line like any other program. That’s only temporary; once you close the shell you’ll revert back to the default when you open another command line.
Many distributions offer a GUI tool for configuring user accounts, and it may be possible to use that to switch shells. It’s also possible, although perhaps not advisable, to directly edit the shell listed in the passwd file.
The best way to change the default shell for your environment permanently is to use the ‘chsh’ tool. For example, if you want to change your shell to zsh, you’d run the command:
chsh -s /bin/zsh
If you’re running a Debian version later than Squeeze, or one of its derivatives, including Ubuntu, then you’re likely already using Dash, as it’s the default for those distributions.
Dash is the Debian Almquist shell and was developed as a replacement for the original Bourne shell. The differences between Bash and Dash aren’t particularly exciting as Dash was designed to be largely compatible (although not entirely). Bash is more feature-rich, but Dash is much smaller and faster. If you have need of a quick and light shell replacement, give Dash a spin.
The Z shell is the slightly younger brother of Bash, and incorporates many of the features of Bash and tcsh, but implements some features that make interactive use a lot more pleasant.
One of the major reasons to give zsh a go is its context based tab completion , which is much more comprehensive than Bash’s default file-based completion. Zsh can tab complete for almost everything you might want, including options and arguments. For example, if you’re using the command ‘chmod’, zsh will complete with usernames, or if you’re using the package manager, zsh can tab complete with package names. It’s great for reducing typos and speeding up command creation.
Zsh is also capable of sharing command history between multiple running shells, which is a boon if you like to have lots of command line windows open at the same time.
Fish, the friendly interactive shell, was designed to make the command line more user friendly. It incorporates handy features like syntax highlighting, and particularly neat is its ability to suggest auto-completions as you type, with much of the same tab completion capabilities that zsh has.
Csh (The C Shell), and its improved descendant tcsh, were created by Bill Joy, the original developer of the vi editor. The goal was to improve on some of the interactive features of the Bourne shell and to make the command line a scripting syntax more in line with the C programming language.
There are very many alternate shells out there, created for all sorts of reasons. We’ve only listed a few here, so if you want to give your favorite a shout out in the comments, feel free.