- Linux Terminal and Console Explained For Beginners
- Terminal is An Interface Between Human and Computer
- The First Terminal
- Character Terminal vs Graphics Terminal
- Linux Terminal Emulators
- What is Console?
- Virtual Console
- What is a Shell
- The Distance Between Terminal and Host
- Wrapping Up
- What is Terminal, Console, Shell and Kernel?
- 1. Terminal:
- 2. Console:
- 3. Shell
- 4. Kernel
Linux Terminal and Console Explained For Beginners
Terminal is the interface through which you type cryptic Linux commands, but is terminal just a window with command prompt on your Linux desktop? Well, the fact is, the terminal you are using now is probably not a real terminal. In this article, I will be explaining the real meaning of Linux terminal and console. Understanding this basic concept is important if you want to master Linux.
Terminal is An Interface Between Human and Computer
As a noun, terminal has many meanings. The Merriam-Webster dictionary gives us a good definition of terminal in the computing field:
a combination of a keyboard and output device (such as a video display unit) by which data can be entered into or output from a computer or electronic communications system.
Human and computer are two independent entities. Human need an interface to put information into the computer and read output from it. These days, input device of personal computers includes: keyboard, mouse, and microphone. Output device includes monitor and speaker. They are commonly called peripheral devices. But in the Unix and Linux world, input and output devices are called terminal. The opposite of terminal is the host, which includes devices like CPU, RAM, HDD and so on.
So now we have two equations.
Computer = Host + Terminal Terminal = Input device + Output device
The First Terminal
Personal computers came into daily lives in the late 1970s. Before then, we can only use expensive mainframes and minicomputers in big companies or universities. The PDP-7 minicomputer used by Ken Thompson and Dennis Ritchie (The two creators of Unix) cost 72,000 US dollars in 1965, and the GE-45 mainframe cost 10 million US dollars.
Ken Thompson and Dennis Ritchie wanted to make Unix become a multi-user operating system, which means each user would have a terminal to connect to the computer. Each user needs a monitor and keyboard. However, every computer devices, including monitor, were very expensive in those days. And keyboards were physically attached to computers. There was no detachable keyboards then.
So they found an alternate solution: use the cheap ASR33 teletype as terminal. Teletype (TTY) was mainly used to send and receive typed messages in telegraphy, but they can also be used to put information into computer and get information out from it. You use the keyboard to input information and print output on paper.
Many teletypes were connected to one Unix computer. Every user can log into Unix with their own username and password, sitting in front of their own teletypes. So Unix became the first multi-user operating system and ASR33 became the first Unix terminal. Due to this fact, the acronym TTY is commonly used to represent terminal in Unix/Linux.
Over the years, terminals became more and more advanced. In 1970, DEC (Dgital Equipment Corporation) introduced the VT05 video terminal. It has a monitor with a video screen for output.
Character Terminal vs Graphics Terminal
Character terminal is also known as text terminal, which can only output text-based information. Teletypes are character terminals. The most famous character terminal is the VT100 made by DEC in 1978. It’s designed so well that it became a standard for later terminals.
Graphics terminal is better because it can also show graphics/pictures on the screen. The most famous graphics terminal is X Terminal, which provided the basic support for the X window system.
Linux Terminal Emulators
Now you know terminal is hardware. In the 1970s and 1980s, people type commands sitting in front of a real terminal. These days we often type commands in a software terminal, which is better known as terminal emulator or terminal emulation application. Sometimes people call them virtual terminal. They are not real terminals, but the operating system thinks they are.
If you use Gnome terminal, you can run the following command to read the manual of gnome-terminal .
It tells you that gnome-terminal is a terminal emulation application. It emulates Xterm.
Xterm is also a terminal emulator. It emulates the VT102 terminal made by DEC. Now you can still find Xterm in your Linux distribution.
What is Console?
In the 1970s and 1980s, terminal are often connected to the host by wire, but there’s a special terminal that is attached to the host. This special terminal is called console. It is used by administrators only. Each computer has only one console. There’s not much difference in appearance between standard terminal and the console, but console can do something that standard terminals can not do. For example, if the operating system failed to boot up, there would be error message displayed on the console, but not on other terminals. And if the operating system boots into single-user mode, you can only use console to login. Other terminals have no permission to login in single-user mode.
PDP-7 minicomputer console
Console and terminal are often seen as synonyms on personal computers. Your monitor and keyboard are the console, and also terminal. You can switch between a standard user and an administrator at any time.
Virtual Console
As a matter of fact, there are two types of terminal emulator. The first type is terminal window you open in a desktop environment. The other type is virtual console. In the 1970s and 1980s, people can often use only one terminal. Heavyweight people in a company or university can use multiple terminals, because they need to do many things with the operating system. So there would be several terminals on their desks.
Nowadays, we don’t need to put multiple terminals on the desk, because Linux can create multiple virtual terminals. One of them is graphics terminal, the other six is character terminal. The 7 virtual terminals are more commonly known as virtual consoles and they use the same keyboard and monitor. Physical console is the combination of your monitor and keyboard. When Linux boots up, it creates the 7 virtual consoles and by default brings you to the graphics console, i.e, the desktop environment. You can run the who command to check which virtual console you are using.
As you can see, I’m using the 7th virtual console (tty 7). If we want to switch to a character virtual console, simply press Ctrl+Alt+ F1 , or Ctrl+Alt+ F2 …. Ctrl+Alt+F6 . To switch back to the graphics virtual console, press Ctrl+Alt+F7 .
When is virtual console useful? If, for some reason, your desktop environment doesn’t respond or the icons/taskbar on your desktop suddenly disappear, you can switch to a character virtual console, and type commands to diagnose the problem.
Note: On Fedora, tty1 is the default graphical virtual console.
What is a Shell
Terminal is just a mechanism to transfer information. For the operating system to understand the information, a shell is needed. A shell in Linux is a program that interprets the commands you enter in a terminal window, so the operating system can understand what you want to do.
There are many shell programs, such as Bash, Zsh, Csh, Ksh etc. Bash is the default shell on most Linux distributions. When you open a terminal window, a Bash shell is automatically started. To check which shell you are using now, run the following command.
The Distance Between Terminal and Host
Terminals can be directly connected to a host on a laptop computer. Terminals can also be connected to a host by wire like a desktop computer. Actually, terminals can also connect to a host over the network. For example, if you have two computers in a LAN. One of them run Linux. You can use the other computer to log into the Linux computer using SSH, or VNC. Thus, the Linux computer is the host and the other computer is the terminal.
A virtual private server (VPS) running in a data center doesn’t have its own terminal (keyboard or monitor). Hosts without terminals are referred to as headless systems. If you have a VPS running in a data center, you can use SSH to remotely log into the VPS, so your local computer becomes a terminal of the VPS host.
Wrapping Up
I hope this article helped you understand Linux terminals, consoles and shells. As always, if you found this post useful, subscribe to our free newsletter to get more tips and tricks 🙂
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.
1. Terminal:
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:
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.
2. Console:
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.
3. Shell
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:
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.
4. Kernel
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 e xample 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: r ead() 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.