Linux Virtual Console and Terminal Explained

This tutorial explains what Linux virtual consoles and terminals are and how they work in Linux with examples. Virtual consoles and terminals allow multiple users to login and access a Linux system simultaneously.

Linux Virtual Console (Terminal)

To understand the Linux virtual console concept, we have to look back in 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.

terminal concepts explained

A device known as terminal which contains only few parts and a monitor with integrated keyboard is used to access the mainframe computer. The earliest terminals were also known as teletypes (abbreviated TTY).

linux terminal

Terminal connects with mainframe computer on serial console port. Once connected, it uses all resources such as CPU, RAM and Hard disk from mainframe computer.

terminal and mainframe computer

Since a terminal directly communicates with system at low level on dedicated serial console port, it does not need any special service, software or application to run. When you booted up the terminal, you would see a login prompt called Linux console on monitor.

In terminal, Linux console is the only place where you can enter commands for system. Linux operating system installed in mainframe computer emulates each console as a separate system with a separate login session.

Over the time, technology improved and the price of personal computers came down which made companies to switch on personal computers from mainframe computers. Personal computers not only have all necessary resources for operating system but also easier to setup and manage.

Since PCs have all necessary resource for operating system, instead of connecting those with mainframe computer companies preferred to install an individual operating system in each PC. Gradually terminals became outdated and replaced by PCs.

Even though terminals are history now, terminal concept still exists in Linux operating system. A Linux operating system not only have necessary software configuration that allows physical terminals to connect with it but also offers a way to access that software configuration virtually. That way is known as virtual console.

physcial console vs virtual console

Physical console: - A physical terminal device connected with Linux system on serial port via serial cable physically.

Virtual console: - An application that simulates a physical terminal device in software and connects it with Linux system on serial port through software configuration virtually.

Physical terminal device: - A physical device that consisted of nothing more than a monitor and keyboard attached to it. It uses all resources such as CPU, RAM and Hard disk from server system.

Virtual terminal application: - An application that provides a text based environment to access the shell. Since physical terminals are no longer used, it became common practice to use the word terminal to refer the virtual terminal application.

Number of virtual consoles

Different Linux flavors offer different number of virtual consoles. For instance, RHEL provides six virtual consoles while Ubuntu provides seven virtual consoles. Virtual consoles are always mentioned along with one physical console (also known as default console). So, the actual number of virtual consoles remains one less than the total number of consoles. For example, in RHEL and Ubuntu the number of actual virtual consoles are 5 (six - one) and 6 (seven - one) 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 user to access several sub-shells simultaneously. CLI contains only command line interface and allows user to access a single shell at a time.

Linux allows us to select or skip GUI environment during the installation. If it is selected, GUI is installed in physical console and CLI is installed in virtual consoles. If it is skipped, CLI is installed in both physical and virtual consoles.

Whether you install GUI or not, in virtual consoles always CLI environment is installed. As they simulate the physical terminals which were designed only to access the CLI environment.

Just like the total number of consoles, sequence of physical console and virtual console is also Linux flavor specific. For example, in RHEL GUI is available as the first console while in Ubuntu it is available as the last console.

Difference between virtual console and terminal

Virtual console uses a single terminal to provide workspace and command prompt. Since a virtual console offers only CLI interface and usages a single terminal to access that CLI interface, the words virtual console and terminal are sometime interchanged. But both words have different meaning.

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.

How to access virtual console

Virtual consoles can be accessed by holding the Ctrl and Alt keys and pressing a function key between F1 and F6. Let’s take an example.

Hold down the Ctrl + Alt keys, and press F4 to access a virtual console. In virtual console, login from user root and run who command.

access terminal

The who command lists the currently logged in users along with the console number where they are logged in.

When you are finished, you can use exit command to logout from virtual console.

Switching between virtual consoles

You 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 back in GUI from virtual console, you may use only Alt+F(1,2,3,4,5,6) keys. While switching between virtual consoles or accessing GUI from virtual console, Ctrl key is optional. It is required only when accessing virtual console from GUI.

That’s all for this tutorial. If you like tutorial, please don’t forget to share it through your favorite social channel.

ComputerNetworkingNotes Linux Tutorials Linux Virtual Console and Terminal Explained