Technically Speaking

The Official Bigstep Blog

 

Top 5 Linux Shells and How to Install Them

The shell is an interactive interface that allows users to execute other commands and utilities in Linux and other UNIX-based operating systems. When you login to the operating system, the standard shell is displayed and allows you to perform common operations such as copy files or restart the system.

Linux shells are a lot more powerful than the Windows command line, because they function as a scripting language as well, with a complete set of tools. Multiple shells can be installed on a system and it is possible to quickly switch between them. Every shell comes with its own syntax and scripting features, let’s discuss the most common options and how to install them on a Cent OS 7 server.

Bash

Bash, or the Bourne-Again Shell, is by far the most widely used choice and it comes installed as the default shell in the most popular Linux distributions. It was developed from the original UNIX Bourne shell (also known as sh) and was designed to be fully compatible with the old scripts, while adding multiple improved features.

Bash is a very solid shell option, since it has been used for a long time and there is ample documentation for it. In fact, most online tutorials will assume that you’re using bash.

As a result, it is recommended for most users and works great for most common system administration tasks. However, if you need more powerful scripting options or other advanced tools, it is time to explore some of the newer shells available.

Zsh

Zsh or the Z-shell was designed from the onset to be interactive and incorporate some of the best features of older shells. It provides unique scripting features, it is highly customizable and is easy to use, with spelling correction, command completion or filename globbing.

Installation on CentOS is very easy, with a single command:

yum install zsh

You can now launch the new shell, with the zsh command, you’ll notice a small change in the way the prompt looks:

Keep in mind that you should configure zsh before using it in order to benefit from its most powerful features. Several open-source frameworks, such as oh-my-zsh, are available for even more customization options and plugins.

Korn

KornShell (also known as ksh) is a very old bash alternative that has been developed in the 1980s. It is very similar to bash but doubles as a complete and powerful programming language, so it has a number of passionate fans among sysadmins. It is not widely used, so it’s a bit more difficult to find online documentation or help.

Installation and launch are again very simple in CentOS:

yum install ksh

Tcsh

Tcsh is a better version of the C shell (csh), which was developed in the UNIX era. It is favored by programmers because its syntax is very similar to the C programming language, so they can use its scripting features without having to learn bash. It is also the default shell in operating systems from the BSD family.

It offers several other useful features, such as job control, a command-line editor or a configurable command-line completion tool. Tcsh is installed with yum from the standard repositories.

Fish

Fish, or the friendly interactive shell, aims to be simpler to use and more user friendly than its competitors. It is a great choice for Linux beginners, because it uses colors to help the user. For example, commands with incorrect syntax are displayed in red, while correct ones are blue.

In addition, fish provides very useful auto-complete suggestions and even parses the man pages of any new installed package and suggests command completions based on them.

Run the following commands to install Fish in CentOS7:

cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/shells:fish:release:3/RHEL_7/shells:fish:release:3.repo
yum install fish

You can now launch the new shell:

Which of these shells is the best? That depends on your actual use case. Bash is a great all-rounder, with excellent documentation, while Zsh adds a few features on top of it to make it even better. Fish is amazing for newbies and helps them learn the command line. Ksh and Tcsh are better suited for advanced users, who need some of their more powerful scripting capabilities.

About the Author

Dragos Baldescu is a Level 2 Technical Support Engineer at Bigstep, passionate about Linux and testing out new technologies and solutions.

Got a question? Need advice? We're just one click away.
Sharing is caring:TwitterFacebookLinkedinPinterestEmail

Readers also enjoyed:

A Rookie Sysadmin’s Guide to Troubleshooting Wordpress

Wordpress is the most popular content management system with more than 60 million websites using it around the globe. It has many themes and…

Top Linux Web Servers: Pros and Cons

For a long time, Apache was the only option as a Linux web server and held almost a monopoly in the open-source market. Today, things have changed, and…

Leave a Reply

Your email address will not be published.

* Required fields to post your comments.
Please review our Privacy Notice in order to understand how we process your personal data and what are your rights in this respect.