What is Terminal, Console, Shell and Kernel?
As a fresher, while learning Linux we get confused with the actual meaning of the terms like-Terminal, Console, Shell, and Kernel. Sometimes we mix up their usage which is technically incorrect so having a clear grasp of what every word actually means and how and where they should be used is very important.
For those having Linux OS, when we click to open the icon having the name “Terminal”, a window is opened, so in simple terms that rectangular frame or window is called terminal. With the invention of modern computers, we have this application named “Terminal”, which we can simply open with a click but during the 80s, it used to be known as “Terminal Emulators” which was not a software program but hardware, a normal Input-Output Device consisting of a keyboard and a monitor. Now the confusion arises well this is what a computer is!! But No, the purpose of a terminal is not to process information (like a typical computer) but to send commands to another system. The terminal is a program that provides the user with a simple command-line interface and performs the following 2 tasks:
- Takes input from the user in the form of commands
- Displays output on the screen
We can say the terminal is a dumb thing so it does not know what to do with the input, so it needs another program to process it, and in most cases, it’s the Shell.
In the case of Windows OS, the “Console” performs the same operations performed by the terminal, so we can say for Windows OS, the Console is the alias name for the Terminal. But Console is not opened directly rather we need to open through the Command Prompt which then opens the console or the rectangular frame on the screen.
After writing our commands on the terminal, when we press the Enter key, the terminal passes those commands to another program to figure out what the user wants to do, and in most cases, that program is the Shell, which forms the outer layer of Linux OS, which performs the following functions: 1. 2. 3. If everything is correct, the shell converts the command Into a kernel-understandable form and passes it to the kernel. Else, It returns an error message 4.
Interprets the command given by the end-user Checks the syntax of the command and then Checks whether the command is correctly used or not. The $ prompt appears on the terminal waiting for the next command, Irrespective of whether the previous commands were correct or not.
If everything is correct, the shell converts the command Into a kernel-understandable form and passes it to the kernel.
Else, It returns an error message
The shell is the mediator or the interface between the end-user and the kernel. There are various shell programs we can choose from namely TCSH, KSH, Seashell, Bash, and many more, but the default one on most Linux systems and on the Mac is the GNU Bash.
It’s a computer program that forms the innermost component of an OS after the Shell. As soon as the shell converts the user’s command into kernel-understandable form, the kernel is responsible to execute the commands with the help of its 2 components which are OS libraries and Device Drivers interacting with Application software and device hardware respectively. Following is an example of a C-program execution flow through the OS till the hardware:
Application Software: A C-program is written that takes input from the keyboard Operating System: Shell: Command to execute the program is given by the end-user Kernel: takes the interpreted command from the shell OS Libraries: read() function which is invoked due to scanf() call. Keyboard Device driver: is invoked Hardware: User types the input on the keyboard
By the table above, it is clear that the Kernel acts as the interface between the Application Software and the Hardware. Memory Allocation and the Processor Allocation will also be taken care of by the Kernel.