Yesterday I gave a quick introduction to the Linux operating system. I wrote several paragraphs on its history, what is user vs kernel mode and a bit on user rights. Each of these could be elaborated in more details but today I continue with terminals and shells.
If you haven't read my previous article yet, go check out:
https://read.cash/@valo/the-linux-operating-system-part-1-f81b3c77
So what's a terminal?
The Latin word terminus stands for end or boundary. So a terminal would be some kind of "end" to something? A terminal illness is one that leads to the end of a patient's life. A terminal at the airport is the place where planes land and depart. But for a computer? Yes, back in the days when computers were the size of rooms, there were no memory sticks to put in a slot and give let the computer process it.
Punch cards
A small detour. One of the early media of data storage were punch cards. They were used both as a way of defining the instructions of a computer program and as input data, e.g., some experimental measurements.
Below is a nice example of a card with printed numbers from 0 to 9. Holes can be made in certain positions along the card and then a punch card reader processes them. Further down is a deck of punch cards that run one program. Hopefully don't lose a card or your program can't run anymore.
Output from the computer
Okay, nice, we have executed a program and it has calculated something. So what? Output was printed to paper or again to punch cards. There was a separate end device with a keyboard where you give commands to the computer. The device was also able to print the results. Thus - the end device, or terminal. This is why in programming we still have the print() function in practically all programming languages.
Later on when displays were taken into use, the terminal was emulated. This persists until nowadays and terminals are not going to vanish from the face of Earth any time soon.
Command line
The virtual (emulated) terminal reads and processes the commands entered by the user, thus we speak of a command-line interface (CLI) to a program. Servers are usually administered remotely, i.e., the admin can enter commands from the other side of the planet. This means that generally it is enough to enter commands to the terminal. Still, the majority of the computers (your phone is also a computer) use a graphical users interface (GUI).
And a shell?
A shell is the complicated program that interprets the commands a user enters via the terminal and translates them to the operating system to execute them. Among the most popular shells is bash. It contains a wide variety of utilities to execute programs, process input and output data and control the system. Scripting is a way of executing a series of commands a bit like a program. It saves tons of time and reduces the number of mistakes (assuming that you don't make a mistake DURING scripting ;))
Well written my friend. Command-line is awesome to execute a software application precisely. I use it many times a day.