What’s a shell?

Thomas Sorza
5 min readJun 10, 2023

--

Today I will explain what a shell is, how it works, the differences between terms like “terminal” “shell” and “console”, which kinds of shells exist, and some basic stuff to do in your own shell. So let’s start.

WHAT IS A SHELL?

Before talking about the stuff that we can make with a shell, we need to know what it is. In the GNU Linux operating system, a shell is a command-line interpreter that gives orders to the operating system. But what is a command-line interpreter? Well, when we talk about a command-line interpreter, we refer to software that takes the input, or whatever we write with our keyboard, and brings orders to the operating system based on the input we have written. Congrats! You have already understood what a shell is in very simple words.

Now, to make it clearer, we need to know the layer organization of all Linux operating systems.

source: https://mindmajix.com/shell-scripting-tutorial

Kernel

As a Linux administrator or ethical hacker, you need to know how the operating system works and how the layers are connected. In the image, you have a circular representation of the layers of the OS. In the center, we have the most low-level layer, the hardware, which refers to the physical components of your computer like the CPU, GPU, RAM, storage, and so on. (I will write an article later on focusing on hardware.) If you look closely at the wrapping layer over the hardware, we have the kernel of the operating system, which you can refer to as the core of the operating system. This kernel is the software that has total control over the operations that the OS develops. In simple terms, the kernel controls everything in the operating system, gives instructions, and manages all the tasks of the system. The important part is how we can give the instructions to the kernel, and that’s when we talk about the next layer in the operating system, the shell.

Terminal

The shell is the software that allows you to give instructions to the kernel to allow the operating system to develop an operation or task. Here, it’s important to make a distinction between the terms terminal, console, and shell. First we have the terminal, which makes reference to the very first computers with monitors, in which you could only write operating system instructions. In the early beginning of digital technology, these were black windows with white or green letters, just like this:

A VT100 terminal. Source: https://vgkits.org/blog/what-is-a-terminal/

Nowdays we don’t use a terminal, we use a terminal emulator. It is another piece of software that allows you to open a window in your operating system, just like a physical terminal, but now you can use a single program in your PC. Talking about the terminal, you should hear the terms “console” orCLI”, These two terms are very similar, and in daily life you shall not say something like,

“-Dude, open your terminal emulator and write the next command to the shell.” ~Literally anybody in the world

If you say that, rest assured that you will sound like an asocial and weird person, even if you say it to someone who knows about TI. Instead, you can refer to your terminal emulator asconsole,” or just like terminal, it’s a command line interface (CLI), but this one is just a little bit technical. So you have many terminal emulators to choose from. Personally, I recommend Terminator, a very powerful terminal emulator with a lot of features, and you can combine it with an external multiplexor like TMUX to make it even better (I will make an article only about TMUX, including Oh My TMUX). Another personal recommendation is Terminus, but the decision is up to you.

Image of an actual terminal emulator (Splited horizontally): Terminator, running ZSH and Tmux on Parrot OS.

SHELL

Finally, to focus on the shell, we have a few types of shells that you can choose from to use in your terminal emulator. You can use the shell of your preference with the terminal emulator of your choice. The differences between the different shells are, well, the different options of commands; in some shells, some commands work and in others, they may not; speed when executing commands; and personalization options. But in a general overview, you can work freely with any shell of your choice; the most common now are bash, fish, and zsh. But the list is long:

Here is a list of the shell names commonly used in Linux:

1. Bash
2. Zsh
3. Ksh
4. Csh
5. Tcsh
6. Dash
7. Fish
8. Sh
9. PowerShell

This is not an exhaustive list; there are many more out there, but these are the most relevant ones. Here you have proof that the majority of the programs and utilities of the last layer that you would like to use will work regardless of the shell that you are using. Each shell software has its own advantages and disadvantages.

NOTE: Shells like Reverse Shell, Bind Shell, and Web Shell are topics for other post.

Comparison between ZSH, BASH, and SH.

To start in the linux terminal and shell scripting, the bash shell would be a very good option for beginners because it is one of the default shells in most linux distributions, but I personally recommend using ZSH. It’s a huge, powerful shell with many options for personalization; you can use oh my zsh! to personalize it. It also has massive speed and options to have custom functions in the terminal, for example.

I hope that you have already understood the differences and main topics between a shell, a terminal, a terminal emulator, the layers of the OS, the uses of each software, and the feeling to start using Linux right now. See you later; I will continue posting Linux content.

Take care and continue learning.

--

--

Thomas Sorza

System and Computation Engineering (Ingeniera de Sistemas y Computación) student, Linux administration, and networks passionate Loving the terminal and Python