How to Switch Between TTY Screens Using the Chvt Command on Linux

Linux TLDR
Last Updated:
Reading time: 2 minutes

This article requires knowledge of TTY in Linux. If you are unfamiliar with this term, check out our recent article on TTY and PTY in Linux, then come back to continue this article.

So, to switch between different TTY screens (or virtual consoles) in Linux, you have to use the following shortcut keys that vary from system to system:

  • CTRL + ALT + F1 – Lockscreen
  • CTRL + ALT + F2 – Desktop Environment
  • CTRL + ALT + F3 – TTY3
  • CTRL + ALT + F4 – TTY4
  • CTRL + ALT + F5 – TTY5
  • CTRL + ALT + F6 – TTY6

But if you are in bad luck because either your “CTRL“, “ALT“, or “FUNCTION” key is broken and can’t function any more, then you can use the chvt command to swim between these TTY screens.

Tutorial Details

DescriptionChvt (Change Foreground Virtual Machine)
Difficulty LevelModerate
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisiteschvt
Internet RequiredNo

Syntax of the Chvt Command

The chvt command takes two arguments: one is the option, and the other is the number (representing the position of the TTY screen).

$ chvt [OPTION] [N]

The following are known options for this command:

  • -V” or “--version“: Display the program version.
  • -h” or “--help“: Display the help section.

The following is the position of all TTY screens in number using this command:

TTYInstead of this shortcut keyUsing this command
LockscreenCTRL + ALT + F1chvt 1
Desktop EnvironmentCTRL + ALT + F2chvt 2
TTY3CTRL + ALT + F3chvt 3
TTY4CTRL + ALT + F4chvt 4
TTY5CTRL + ALT + F5chvt 5
TTY6CTRL + ALT + F6chvt 6

Usage of the Chvt Command

So, to explain the usage of this command, I assume that you are already present in the TTY3 screen, as shown.

Virtual Console 3 (or TTY3)

Now, if you want to switch to another TTY screen, like TTY4, then specify its position number as an argument to the chvt command.

$ chvt 4

Output:

Switching from TTY3 to TTY4

Now, if you want to switch back to the previous TTY3 screen, then follow the same steps, using its position as an argument to the chvt command in your TTY4 console.

$ chvt 3

Output:

Switching from TTY4 to TTY3

Following this way, you can swim between all the TTY screens and use each console to do separate tasks (multitasking).

If you have a desktop environment installed on your system, then you can switch to lockscreen or homescreen using its position number.

For example, I am currently in TTY3 and want to access my system home screen; to do so, I will use the “Desktop Environment” position number (which is “2“) and specify it as an argument to the chvt command, as shown.

📝
Instead of the home screen, you might be redirected to the lock screen if you have been away for a long time because your system will reach its standby time (a feature of DE to save battery).
$ chvt 2

Output:

Switching from TTY3 to DE

That’s all this command does.

If you have any question or query related to this topic, then feel free to ask us in the comment section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.