Linux Virtual Console and Terminal Explained

Linux is a multiuser operating system. It allows many users to connect and use the system simultaneously. Users use virtual consoles or terminals to connect and access the system. This tutorial provides a detailed description of these virtual consoles and terminals.

To understand the Linux virtual console concept, we have to look back at the history of computers. In earlier days, computers used to be very expensive. Instead of personal computers, companies used to prefer mainframe computers. A mainframe computer allows multiple users to connect with it separately. In mainframe computing, every user accesses the mainframe computer as a separate computer.

explaining the terminal concept

Users use terminals to connect and access the mainframe computer. A terminal contains a monitor, an integrated keyboard, and a few more parts required to connect with the mainframe computer. Unlike a personal computer, it has no CPU, RAM, Motherboard, or Hard disk.

Linux terminal

A terminal connects with the mainframe computer on the serial console port. Once connected, it uses all the resources of the mainframe computer.

terminal and mainframe computer

Since a terminal directly communicates with the system at a low level on a dedicated serial console port, it does not need any exceptional service, software or application to run. When you start the terminal, you see a login prompt called Linux console on the monitor. The Linux console is the only place you can enter system commands on the terminal. Linux operating system installed in the mainframe computer emulates each console as a separate system with an individual login session.

Over time, technology improved, and the price of personal computers decreased, making companies switch to personal computers from mainframe computers. Personal computers have all the necessary resources for operating systems. They are also easy to set up and manage. Since PCs have all the necessary resources for operating systems, companies prefer to install an individual operating system in each PC instead of connecting those with mainframe computers. Gradually, terminals became outdated and replaced by PCs.

Even though terminals are a part of history now, the concept of terminals still exists on the Linux operating system. A Linux operating system has the necessary software configuration that allows physical terminals to connect with it and offers a way to access that software configuration virtually. That is called a virtual console.

physical console v/s virtual console

Physical console
A physical console is a terminal device physically connected to a Linux system on a serial port via a serial cable. It contains only a monitor, keyboard, and essential parts to connect to the mainframe computer.

Virtual console
A virtual console is an application that simulates a physical terminal device in software and virtually connects it with the Linux system on a serial port through software configuration. Since physical terminals are outdated, using the word terminal to refer to the virtual terminal application is common.

Number of virtual consoles

Different Linux flavours offer different numbers of virtual consoles. For instance, RHEL provides six virtual consoles, while Ubuntu offers seven.Consoles always start with a physical console, known as the default console. Because of this, the actual number of virtual consoles remains one less than the total number of consoles. For example, in RHEL and Ubuntu, the number of virtual consoles is 5 (6 - 5) and 6 (7 - 6), respectively.

Default working environment in virtual console

Linux provides two types of working environment: GUI (Graphic User Interface) and CLI (Command Line Interface). GUI contains the Desktop environment and allows users to access several sub-shells simultaneously. CLI contains only a command line interface, enabling the user to access a single shell.

Linux allows us to select or skip the GUI environment during the installation. If selected, the installation process installs GUI on the physical console and CLI on virtual consoles. If skipped, it installs CLI on both physical and virtual consoles. Whether you install GUI or not, it always installs CLI on virtual consoles. They simulate the physical terminals designed only to access the CLI environment.

Like the total number of consoles, the sequence of accessing the physical and virtual consoles is also Linux flavour-specific. For example, RHEL provides GUI as the first console, whereas Ubuntu offers it as the last.

Difference between virtual console and terminal

A virtual console uses a single terminal to provide the workspace and command prompt. Since a virtual console offers only the CLI interface and uses a single terminal to access that CLI interface, users commonly interchange the words virtual console and terminal. However, both words have different meanings. The word virtual console refers to an application that simulates a physical terminal, while the word terminal refers to an application that allows us to access and use the shell.

Accessing a virtual console

We can access virtual consoles by holding the Ctrl and Alt keys and pressing a function key between F1 and F6. Let's take an example.

Hold the Ctrl + Alt keys and press F4 to access a virtual console. Log in from the user root and run the who command. The output lists all logged-in users and their terminal numbers.

accessing a terminal

Use the exit command to log out from the virtual console.

Switching between virtual consoles

We can cycle through virtual consoles using the Crtl+Alt+F1 to F7 keys. Switching does not terminate the active login session. Each virtual console is independent and separate. To switch between virtual consoles or to return to GUI from a virtual console, use the Alt+F(1,2,3,4,5,6) keys. The Ctrl key is optional while switching between virtual consoles or accessing GUI from a virtual console. We only need to use it when accessing a GUI virtual console.

Conclusion

Virtual consoles provide an effective way to simultaneously log in from various users for testing and debugging applications. Each virtual console works as a separate terminal. We can access virtual consoles using Alt, Ctrl and function keys.

ComputerNetworkingNotes Linux Tutorials Linux Virtual Console and Terminal Explained

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com