When you keep hearing about these terms...like Shell, Command-Line, PowerShell, Bash, etc. You might wonder how does each term mean and how exactly do they fit in computers or the use of it.
I will try to explain with the help of some resources and using simple language what each of those terms means and specifically what a shell is.
PLEASE NOTE: A big part of this blog post has been condensed, quoted, and paraphrased from Google's IT Coursera Course which is available for free.
Before we start to understand what a shell is, we need to know what an operating system is. I won't go too deep but please follow along.
In a computer, you need an operating system for it to work and you to be able to do what you want (A computer can actually work without an operating system, but for our argument's sake let's say that was the case). Operating system allows hardware to communicate with the system. In other terms an operating system is the whole package that manages our computer's resources and lets us interact with it.
In short, an operating system, or "OS," is software that communicates with the hardware and allows other programs to run.
There are two main parts to an Operating System.
1. The Kernel Space
The Kernel is the main core of an operating system. It talks directly to our hardware and manages our system resources. As users, we don't interact with the kernel directly. Instead, we interact with the second part of an operating system, the user space.
2. The User Space
The User Space is basically made up of everything outside the kernel. These are things that we interact with directly like system programs, user interfaces. etc.
To reiterate, when we say operating system, we're talking about both the kernel and the user space.
Why is it called a Kernel? In simple English, a kernel is "a softer, usually edible part of a nut, seed, or fruit stone contained within its hard shell". Also, the definition goes further by saying a kernel is "the central or most important part of something".
Check this diagram below
So you can see from the explanation of the term why this part of the operating system was named the Kernel. About the history itself, and who named it...I couldn't easily find out but be free to leave your comment below if you know about it.
Now let's see another diagram.
Just like you see in the above diagram, The Kernel does file storage and file management. It's the File Manager.
Another important function of the kernel is Process Management. Process Management is basically the management of how our programs run, the order in which they should run, and how much computer resource they should use.
Memory Management. The kernel optimizes memory usage and makes sure our applications have enough memory to run.
The last function of the kernel is Input/Output Management or in short I/O Management. This is how the kernel talks to external devices like disks, keyboard, networks, connections, audio devices, and more.
So, those are the four functions of the kernel: File Management, Process Management, Memory Management, I/O Management.
Again, the other part of the Operating System is The User Space which is everything outside of the Kernel. The User Space is composed of things that we interact with directly like programs, such as text editors, music players, system settings, user interfaces, etc.
Now you might think am beating around the bush...No I'm not. Here is where the Shell comes in...
The User Space is basically how we humans interact with the operating system. When we interact with the operating system we do certain functions like create files and folders, open applications, delete files, etc.
There are two ways that we can interact with the Operating System. The first way is with a SHELL. And the second way is by using a Graphical User Interface (GUI). There are also some Shells that use Graphical User Interface but as of today's topic, we are focusing on the ones that use Command-Line Interface (CLI). These are called CLI shells.
Command-Line Interface is text-based. "The user can type commands to perform functions such as run programs, open and browse directories, and view processes that are currently running."
A Graphical User Interface (GUI) is a visual way to interact with a computer. We use our mouse 🖱 to click and drag, to open folders 📂, etc. We can see everything we do with a GUI. Most people use GUIs every day when interacting with computers... i.e. clicking icons and navigating menus to open your browser and navigate to a certain website.
GUIs are also used to differentiate between certain products or devices. You can easily tell a Windows application from a Mac application by just looking at the GUI of each application - the menus, icons, windows will be different.
Now, what's a SHELL?
A shell is basically a program that interprets text commands from the user and sends them to the Operating System to execute. In other words, a shell is a computer program which exposes an operating system's services to a human user or other program.
Before fancy visual interfaces were invented, commands like 'create a file' had to be typed out. While we have GUI today the shell is still commonly used to run commands, especially by power users. Power users are above average computer users.
There are a lot of different types of shells. Some have different features, some handle performance differently. Also, some have very simple features and others have powerful scripting capabilities i.e. Bash. It's the same concept behind different operating systems.
One of the most common shells is Bash or Bourne Again Shell. And it's available on the Linux Operating System.
In Windows Operating System, there is a shell called PowerShell.
Some tasks can only be completed through text commands, and that's why Shell is so important. Techterms.com says "Since the shell is only one layer above the operating system, you can perform operations that are not always possible using the graphical user interface (GUI). Some examples include moving files within the system folder and deleting files that are typically locked."
Let's take a step back, so why is it called a shell...Take a look at this diagram:
Shell and Kernel go hand in hand. While a kernel is your soft inner part, a shell is "the outer case of a nut kernel or seed".
Now let's put things into perspective: Take a look
In short, we can say that a shell program is a program which provides an interface between the user and the operating system (the kernel). A shell is the outermost layer around the operating system.
Just like you would need to get through the shell of a walnut to get access to (eat) the kernel, the same way you need a shell to get to the kernel space of the operating system. In simple terms, you 'can't' access the magical powers of the kernel without first going through the shell.
The shell provides a means of communication (a way to interact) between what's inside which is the operating system's kernel and the outside which is the user space or the user. The kernel itself doesn't interact with the user directly but rather it interacts with the shell.
Previously I had mentioned that we have a lot of types of shells and I gave examples like PowerShell for Windows and Bash for Linux. There are a few other shells as you can see in the above picture, you have Zsh or The Z Shell, Csh (C Shell) and Tcsh (T C Shell). The TCSH is an improved C Shell. But that's not all, there are way more. For today those few shells should be enough examples.
You're ready. Start making stuff.