The Linux operating system - terminal, command line, shell

6 56
Avatar for valo
Written by
3 years ago

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.

A deck of punch cards. Image by Arnold Reinhold (CC BY 2.0) via Wikimedia Commons. https://upload.wikimedia.org/wikipedia/commons/c/c0/MIT_punched_card.agr.jpg Licensed under the Creative Commons Attribution-Share Alike 4.0 International license. https://creativecommons.org/licenses/by/2.0/deed.en
A deck of punch cards. Image by Arnold Reinhold (CC BY 3.0) via Wikimedia Commons. https://upload.wikimedia.org/wikipedia/commons/2/26/Punched_card_program_deck.agr.jpg Licensed under the Creative Commons Attribution-Share Alike 4.0 International license. https://creativecommons.org/licenses/by/3.0/deed.en

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.

A programmer looking at two files of source code for a program or a script. (Picture source: Unsplash)

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 ;))

Further reads:

https://www.computerhope.com/jargon/p/punccard.htm

https://en.wikipedia.org/wiki/Computer_terminal

5
$ 3.21
$ 3.20 from @TheRandomRewarder
$ 0.01 from @mc5punk
Sponsors of valo
empty
empty
empty
Avatar for valo
Written by
3 years ago

Comments

Well written my friend. Command-line is awesome to execute a software application precisely. I use it many times a day.

$ 0.00
3 years ago

I totally agree! And scripting is way more efficient than one can possibly do by clicking with the mouse.

$ 0.00
3 years ago

I click when it is correctly doing the job without any possibility of errors. Otherwise, I run commands.

$ 0.00
3 years ago

This publication is excellent, I loved it, there is information that I did not know. Thanks for sharing it, my friend.

$ 0.00
3 years ago

Thank you for the kind words and the support! I appreciate it. This gives me inspiration to write more articles.

$ 0.00
3 years ago

Keep going, my friend, little by little you will achieve success.

$ 0.00
3 years ago