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
Description | Chvt (Change Foreground Virtual Machine) |
Difficulty Level | Moderate |
Root or Sudo Privileges | No |
OS Compatibility | Ubuntu, Manjaro, Fedora, etc. |
Prerequisites | chvt |
Internet Required | No |
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:
TTY | Instead of this shortcut key | Using this command |
---|---|---|
Lockscreen | CTRL + ALT + F1 | chvt 1 |
Desktop Environment | CTRL + ALT + F2 | chvt 2 |
TTY3 | CTRL + ALT + F3 | chvt 3 |
TTY4 | CTRL + ALT + F4 | chvt 4 |
TTY5 | CTRL + ALT + F5 | chvt 5 |
TTY6 | CTRL + ALT + F6 | chvt 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.
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:
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:
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.
$ chvt 2
Output:
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.