Kernel and Shell in Linux – Simplest Explanation
Kernel and Shell are the most important components of Linux. We may think Shell as an examiner, if a command is suitable then only the Kernel run the command. Let’s learn it in detail.
What is Shell in Linux?
Whatever we do in Linux, Shell watches each and everything. Let’s take an example, please run the below commands one by one.
echo Hello World
and after that, run the below command.
echo Hello World
Did you see the difference? Well both the commands will print only Hello World. Here is the proof.
But why they are printing the same? The second command should print the Spaces too. The multiple spaces are reduced to a single space. However the “echo” command does not print this, the Shell does this. Shell looks for some special characters. The multiple spaces seem to be a special character to the Shell. So, the shell squeezes all the multiple spaces into a single space, and that’s why it was printing without all the spaces.
If you still want to print those spaces, you may use the below code, this time the spaces will appear.
echo "Hello World"
Types of Shell in Linux:
Most important Types are:
- PDKSH – Public Domain Korn Shell
- TCSH – TENEX C Shell
- BASH – Bourne Again Shell
Keep in Mind
Shell is actually the interface between the user and the Kernel. Shell has a programming capability of its own. We will see that later. Shell behaves like an examiner to each and every command. Firstly Shell analyzes the command and its arguments and then it tries to modify it to simplify. Then, after the simplification, Shell forwards the command to the Kernel, and then Kernel executes the command.
What is Kernel in Linux?
Many researchers said that Kernel is the “Heart of the System”, and they mean it. The Kernel actually runs the commands it gets from the Shell. A kernel is basically a collection of programs that directly communicates with the hardware. When the system boots up, it also loads in memory. The kernel does all the tasks like allocating memory, handling processes, and many other tasks. But, there is only one Kernel for any system.
Kernel = Operating System?
You got it right, the Kernel is often called the Operating System.
You can find the Kernel of your Linux in this location: /vmlinuz.
You can find the Shell of your Linux in this Location: /bin/bash
Do not forget to check our YouTube Channel – Tec4Tric.