Note: This post is an English adaptation of my original Chinese article (URL). Some parts have been modified for clarity, cultural relevance, or to better fit the English-speaking audience. The original Chinese text is provided on the next page (2nd page) of this post for reference and comparison. I hope this translation bridges the understanding for those interested in computing concepts across different languages and cultures 🙂
In the world of computing, terms like terminal, shell, tty, and console are often thrown around, but their distinctions can be subtle and confusing. Before we dive deeper, let’s define these terms briefly:
- TTY: Stands for teletype, the original terminal devices. The term tty has become a generic name for terminals.
- Terminal: A piece of “hardware” or “software” (terminal emulator) dedicated to human-computer interaction.
- Console: A higher-level terminal with special permissions, capable of displaying messages that regular terminals cannot.
- Shell: Software that interprets commands for the kernel, the core of the computer’s operating system.
If these definitions seem baffling, don’t worry. I’ll explain them using a simplified and relatable analogy.
The Kingdom Analogy
Imagine a kingdom (the operating system of your computer) ruled by a king (the kernel). One day, a foreign merchant (the computer user) wishes to trade with the kingdom. However, there’s a language barrier, as the merchant does not understand the kingdom’s language (computer commands).
To solve this, the king employs a translator (the shell), who can interpret between the king and the merchant. However, the king decides that the merchant should stay outside the city walls, communicating via a messenger (the terminal).
The merchant might wonder, “Why can’t I speak directly to the translator?” The king’s policy is that direct communication is reserved for insiders. In real-life computing, when you open a terminal emulator, it automatically calls upon the shell, but I’ve separated them into two entities here for clarity.
Now, let’s play out a scenario:
The merchant says, “I want to buy an apple for 1 shell.” (Note: Here, ‘shell’ amusingly refers to a seashell, not the computing term haha.)
The messenger relays this to the translator (the terminal sends the command data to the shell), who then translates this into the king’s language (the shell interprets the command). The translator informs the king: “He wants to buy an apple with 1 shell.”
Upon hearing this, the king commands, “Give him an apple for one shell.” (The kernel processes the command and returns the result.)
The translator translates the king’s command back into English and informs the messenger, who then tells the merchant, “Yes, you can have an apple. Please place the shell on the ground.” (The terminal outputs the execution result to the user, completing 1 interaction loop.)
Leave a Reply