Linux/Unix Virtual Terminal

โšก Smart Summary

Virtual terminals are text-based consoles that let several users run commands on one Linux computer at the same time, each logging in separately, switching with keyboard shortcuts, and working entirely without a mouse.

  • ๐Ÿ–ฅ๏ธ What they are: Virtual terminals are command-line consoles like the standard terminal, except the mouse does not work, so keyboard shortcuts become essential.
  • ๐Ÿ”ข Six by default: Linux provides six virtual terminals, and each one can hold a separate user session for different tasks at once.
  • โŒจ๏ธ Starting one: Press Ctrl+Alt+F1, then enter a user ID and password to log in and begin working.
  • ๐Ÿ” Navigating: Switch between terminals with Ctrl+Alt+F1 through F6, and note the tty number shown at the top of each one.
  • ๐ŸชŸ Seventh terminal: Ctrl+Alt+F7 returns to the graphical desktop session used throughout the other Linux tutorials.
  • ๐Ÿค– AI assistance: AI assistants and GitHub Copilot can generate, explain, and troubleshoot the commands run inside a virtual terminal.

Linux virtual terminal keyboard shortcuts and switching between consoles

Because Linux is a multi-user operating system, several people can work on the same machine at once. Virtual terminals make this possible by providing separate text-based login sessions, so different users can run commands side by side without a graphical desktop.

What are Virtual Terminals?

Virtual terminals are similar to the terminal that you have been using so far. They are used for executing commands and providing input. The only difference is that you cannot use the mouse with a virtual terminal, so you need to know the keyboard shortcuts.

The image below shows the familiar Linux terminal that a virtual terminal closely resembles.

Standard Linux terminal window that a virtual terminal resembles

Virtual terminals enable a number of users to work on different programs at the same time on the same computer. This is one of the most distinguished features of Linux.

Let us learn how to access and use them.

Starting a Virtual Terminal

Usually, there are six (default) virtual terminals on a Linux operating system, and you can log into each one as a different user to conduct different tasks. The steps to launch a virtual terminal are:

Step 1) Press Ctrl+Alt+F1 to open a virtual terminal, as shown below.

Pressing Ctrl+Alt+F1 to open a Linux virtual terminal

Step 2) Enter your user ID and password at the login prompt.

Logging in to a virtual terminal with a user ID and password

Step 3) The virtual terminal is now ready to work on.

Working on a Linux virtual terminal after logging in

Navigating through Virtual Terminals

You can navigate between the six virtual terminals using the following key combination.

Ctrl + Alt + F (1 to 6) key

F1 is the first virtual terminal, while F6 is the last. You can keep a session open on all of them at the same time.

To check which virtual terminal you are working on, note the tty value shown at the top of the screen.

The tty number displayed at the top of a virtual terminal login screen

tty is the teletype number, which you can also find by typing the command “tty”.

Output of the tty command showing the current teletype number

The seventh terminal

The seventh terminal is the one we have been using so far in the Linux tutorials. It can be accessed by pressing the key combination given below.

Ctrl + Alt + F7

On many modern Linux distributions the graphical desktop instead runs on the first or second virtual terminal, so the exact function key that returns you to the desktop can vary from one system to another.

Virtual Terminal shortcuts

These are some of the shortcuts that you should be aware of while working on virtual terminals and other Linux command sessions.

Shortcut Function
Home or Ctrl + a Move the cursor to the start of the current line
End or Ctrl + e Move the cursor to the end of the current line
Tab Autocomplete commands
Ctrl + u Erase the current line
Ctrl + w Delete the word before the cursor
Ctrl + k Delete the line from the cursor position to the end
reset Reset the terminal
history List of commands executed by the user
Arrow up Scroll up in history and press Enter to execute
Arrow down Scroll down in history and press Enter to execute
Ctrl + d Log out from the terminal
Ctrl + Alt + Del Reboot the system

The virtual terminal below shows a working command session where these shortcuts apply.

A Linux virtual terminal displaying an active command session

FAQs

A virtual terminal is a text console handled by the Linux kernel and tied to a /dev/tty device. A terminal emulator, such as GNOME Terminal, is a graphical application that runs inside the desktop and uses a pseudo-terminal (/dev/pts) instead.

Each virtual terminal appears as a device file named /dev/tty1, /dev/tty2, and so on. These files represent the text consoles the kernel provides. Running the tty command prints the device file for the terminal you are currently using.

Use the chvt command, which stands for “change virtual terminal.” Running sudo chvt 2 switches to the second virtual terminal, exactly as pressing Ctrl+Alt+F2 would. This is useful in scripts or when the keyboard shortcuts are unavailable.

Yes. Six is only the default. The consoles are started by getty services, so an administrator can enable additional ones through the system’s init or systemd configuration. Most desktop users keep the default number because the graphical session already occupies one terminal.

The Ctrl+Alt+F-key pattern is standard, but the terminal reserved for the graphical desktop varies. Older systems placed it on the seventh console, while many modern distributions use the first or second, shifting the text consoles accordingly. Check with the tty command.

No. Remote logins over SSH and graphical terminal windows use pseudo-terminals, shown as /dev/pts/0, /dev/pts/1, and so on. True virtual terminals are the local text consoles attached to the physical machine and reached with the Ctrl+Alt+F-key shortcuts.

AI assistants can translate plain-English requests into shell commands, explain unfamiliar output, and suggest fixes for errors. Machine-learning log analysis can also baseline normal console activity and flag anomalies, such as unexpected logins on a virtual terminal, helping administrators detect misuse faster.

Yes. GitHub Copilot offers a command-line interface that suggests commands from a description, explains flags, and drafts small shell scripts. Review any suggested command before running it, especially when it uses sudo or changes system files.

Summarize this post with: