A shell is a program that acts as the outermost layer of an operating system, through which you interact with its various programs and services. Most Linux distributions use bash as their default shell. However, you are free to choose a different shell for your system if you wish.

In addition to bash, Linux also supports other shell programs such as ksh, zsh, csh and fish. Each of these shells has a unique property that sets them apart from Bash and the other shells.

Let's dive in to learn more about the shell and how to change your default Linux shell.

What is a shell and what is its meaning?

A shell is a computer program that you can use to control various elements of an operating system using commands. When you're using a terminal on Linux, you're basically interacting with the shell that sits between you and the operating system, instructing it to run commands.

Most Linux shells have a command line interface (CLI) and require familiarity with commands (and their syntax). When you enter a command in the shell, it looks for the program (in your command) in the system path to determine it. If a match is found, the command will run successfully and you will get the output.

In short, a shell is a powerful and efficient way to communicate with the operating system.

Related: 5 Reasons To Choose Linux Terminal Via GUI

Why would you want to change your default shell?

In general, most of the shells you come across on Linux or other Unix-based systems offer much of the same functionality: they allow for convenient interaction / control of various system elements.

Bash, which comes pre-installed on most Linux distributions, is a perfect example of this. However, when it is stacked against some of the other shells, such as zsh, it lags behind in terms of functionality.

Zsh, on the other hand, brings a number of additional features, such as auto-complete, auto-correct, automatic CD, recursive path expansion, and plug-in support, which gives it an edge over Bash and some other shells.

Of course, these are only a handful of the benefits you get with zsh. Other shells also bring their own features and enhancements, making the overall experience of working with them easier and more convenient.

How to change your default Linux shell

There are several ways to change the default shell in Linux. We demonstrate the process with the chsh Utility in this guide as it is a more reliable and convenient method.

Chsh is a command line utility on Unix-based operating systems that allows you to change the default shell. It's preinstalled on pretty much all Linux distributions.

To use it, all you have to do is provide the pathname of the shell you want to use in the Terminal and it will take care of the rest of the process itself. However, there are a few steps you need to take before you can change your default shell.

Here is a breakdown of those steps.

Step 1: Identify the installed shells

Before installing a new shell, it is important to know which shells already exist on your Linux system. To do this, open the terminal and enter the following:

Cat / etc / shells

Unless you have a new shell installed, your output should look similar to the image below.

Step 2: installing a new shell

After identifying the installed shells on your system, the next step is to install a new shell. In this regard, Linux has a variety of options, each with their advantages and disadvantages. So depending on your preferences and what you want to achieve with the shell, you can choose one that suits your needs.

This guide demonstrates the installation and setup of the zsh shell. Feel free to replace "zsh" with your shell name in the following commands.

To install zsh on Debian-based distributions:

sudo apt install zsh

You can install zsh on Arch Linux with pacman:

sudo pacman -Syu zsh

Installing zsh on Fedora, CentOS, and other RHEL distributions is also easy:

sudo dnf install zsh

After the installation is complete, run the following command to recheck the installed shells on your system:

Cat / etc / shells

Next, check that the installed shell is working. To do this, enter the name of your shell in the terminal. If it's zsh, run:

zsh

To return to the default shell, type exit and hit Enter.

Step 3: Make a shell the default shell for your system

If your newly installed shell appears in the list of installed shells and works fine, you can now set it as the default shell for your system. Note that you can use chsh to change both the default interactive shell and the default login shell.

A login shell is a shell that gives you a terminal after you log into your system, while an interactive shell is available all the time after you log in.

To set zsh (or any other shell) as the default login shell, open Terminal and run:

chsh

If asked for a password, enter your account password and press Enter.

Next, enter the absolute path for your installed shell. This will change the default login shell for your system. To change the default interactive shell in zsh:

chsh -s / usr / bin / zsh

The system will ask you to enter your password for the changes to take effect. Enter your password and press Enter.

After setting zsh (or another shell) as the default and / or interactive shell, log out and log back in for the changes to take effect on your system.

If you now log in again and open the terminal, the system greets you with the shell configurator. Before you can start using your new shell, you'll need to select the options here that suit your shell needs.

When everything is set, check that your newly installed shell is set as the system's default shell. To do this, run the following command:

echo $ SHELL

If you set it to zsh you will see its path in the terminal. In the case of another shell, it should reflect the path accordingly.

Note that if you want to change the default shell for other users on your system, you have to do this for each user. For example, if you want to change the default shell for the user Sam, you need to run the following command:

sudo chsh -s / usr / bin / zsh sam

Change the default shell for a personalized experience

A feature-rich shell offers a number of additional advantages over and above those of the standard shell. And since most of your Linux interactions and operations are done from the command line, changing your default shell to one with more functionality is one of the first steps in personalizing your work environment.

In fact, in addition to changing the default shell, you should customize it and set it up the way you want to improve the overall experience. A good starting point for customizing your shell is to use command line aliases, which make entering commands in the terminal quick and convenient.

14 ways to make Windows 10 faster and improve performance

It's not hard to make Windows 10 faster. Here are several methods to improve Windows 10 speed and performance.

Continue reading

About the author

Yash Wate
(12 published articles)

Yash is Staff Writer at MUO for DIY, Linux, programming and security. Before he discovered his passion for writing, he developed for the web and iOS. You can also find his writing on TechPP where he covers other industries. In addition to technology, he likes to talk about astronomy, Formula 1 and clocks.

More
By Yash Wate

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

One more step …!

Please confirm your email address in the email we just sent you.