Linux Shells – A Complete Guide

Linux Shells

Linux shells are an essential part of any Linux system and can massively affect your workflow and can drastically increase your efficiency. In this module, we shall discuss the three most popular shells in Linux, namely: bash, zsh, and fish.

What Are Linux shells?

A SHELL is a program that lets you interact with the Operating System and serves as a Linux Command Line Interpreter. It provides us a medium to interact with the kernel and an initial medium to configure and modify initial files. This becomes extremely instrumental when we are doing some CLI-only tasks like Arch Linux install and don’t have the GUI tools available to us.

Linux shells can also provide a lot of features that can aid the user with their daily workflow and day-to-day tasks. Some of such useful features are Tab Completion, Syntax Highlighting, and autosuggestions.

How To Check Which Shell Is In Use?

To check the default Shell in use, you can type the following in a terminal :

$ echo $SHELL

This should return you your default shell. However it might happen that you might be in a different shell than your default one. In that case, you can check your default shell with :

$ echo $0

This should give you your current shell.

Some Popular Linux Shells

Below we take a look at the 3 most popular shells in Linux :

Bash: GNU Bourne-Again Shell

It is the default shell on most Linux Distros. It is reasonably customizable and fast. It comes with some nice features like Tab completion and also allows for some really nice shell scripts. The configuration for bash is located in a hidden file called .bashrc in the user’s home directory. To know more about it, read this article.

Zsh: Z-Shell

Zsh is another great shell that is very similar to bash in its base form. However, the point which makes zsh standout from the rest is that is heavily customizable, especially with the aid of OhMyZsh. You can install any number of plugins to extend the shell’s current capabilities and add new features. You can add elements to it like Color Schemes, Auto-Completion, Syntax Highlighting, and such. Read more about it here.

Fish: Friendly Interactive Shell 

Fish or friendly interactive shell and is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family. It is not POSIX compatible, nor it is meant to be so. Fish provides a lot of functionality out of the box like Syntax Highlighting, Auto-Suggestion and such. It also gives us a GUI way to edit our configurations and you need not install any additional plugins for the same. You can still customize it further with OhMyFish. Fish is my personal favourite because one doesn’t need to spend a lot of time configuring as most of the essential features are provided out of the Box.

Changing Your Default Linux Shells

Let’s begin by listing all the shells that are available on your system with the cat command:

$ cat /etc/shells

This should list out all the shells you have available on your system along with their full path. Now, to change your default shell, type in:

$ chsh -s /path/to/shell

This shall change the default shell for the current user. Sometimes you might need to logout and log back in for the changes to take place but after this your default change would be changed to the one you selected.

Conclusion

Hence we discussed a bit about Linux shells. There are still many different types of shell available but these are some of the most popular ones. You can compare and decide which one suits you the best and go ahead and use it.