
deallocvt Command in Linux
The deallocvt command in Linux deallocates kernel memory used by unused virtual terminals. A virtual terminal (VT) or virtual console (VC) feature in Unix and Unix-like operating systems allows different users to access a single Linux machine from independent command line interfaces.
Like other processes, virtual terminals consume resources. It is a good practice to close the unnecessary VTs to prevent unused resource consumption,
Table of Contents
- Syntax for Linux deallocvt Command
- Understanding Virtual Terminals (VTs) in Linux
- Using deallocvt Command in Linux
- Is deallocvt Command Still Useful?
Syntax for Linux deallocvt Command
The syntax of using the deallocvt command in Linux is mentioned below:
deallocvt [N]
In the above command, N is indicated as the virtual terminal number.
The deallocvt command only works on virtual terminals that are not currently in use.
Understanding Virtual Terminals (VTs) in Linux
The virtual terminals are independent consoles that can be used by different users on the same machine. Each VT is an independent session.
The virtual terminal can be created using the following keyboard shortcut −
VT1 | Ctrl + Alt + F1 | Lock Screen |
VT2 | Ctrl + Alt + F2 | Desktop Environment |
VT3 | Ctrl + Alt + F3 | TTY3 |
VT4 | Ctrl + Alt + F4 | TTY4 |
VT5 | Ctrl + Alt + F5 | TTY5 |
VT6 | Ctrl + Alt + F6 | TTY6 |
It is important to note that, in GUI, F1 indicates the lock screen and F2 Desktop environment. So, whenever you press the Ctrl + Alt + F1 you will be sent to the lock screen.
To create a virtual terminal press Ctrl + Alt + F3. A new virtual terminal screen (tty3) will appear as shown in the following image −

Each VT represents a file, for example, VT 3 represents/dev/tty3.
By default, only 6 virtual terminals are allowed to be created, however, this limit can be changed by modifying the NAutoVTs parameter in the /etc/system/logind.conf file.
To list the virtual terminals there are various commands.
who

The output shows that three users are using different terminals on the same machine.
To get process IDs of all the virtual terminals, use −
ps -a

To get details about the specific virtual terminal, use −
ps -t ttyX
For instance, to get the details of virtual terminal 3, replace, /dev/ttyX, with /dev/tty3 in the above command.

The output shows the login and shell processes.
To switch the virtual terminal, press the Ctrl + Alt and the relevant function (F1, F2..) key. Or use the chvt command line utility.
For example, to switch to virtual terminal 3 use −
chvt 3
Login to use the terminal.
Using deallocvt Command in Linux
To deallocate kernel memory of all the virtual machines, use the deallocvt command without arguments.
deallocvt
Any virtual terminal not in the foreground, or not running any process will be deallocated.
To deallocate a specific virtual terminal, type the number.
For instance, to deallocate virtual terminal 3 the following command will be used.
deallocvt 3
For more than one virtual terminal, execute −
deallocvt 3 4 5
The above command is deallocating, /dev/tty3, /dev/tty4, and /dev/tty5.
To get the version of the deallocvt command, run −
deallocvt --version

Is deallocvt Command Still Useful?
The most modern Linux distributions, such as Ubuntu and Debian, no longer use the deallocvt command to manage virtual terminals. Now, systemd manages this task. For example, to stop virtual terminal 3, use the systemctl command with the stop option.
systemctl stop getty@tty3.service

Or if you exit the virtual terminal using the exit command, it will automatically be deallocated. In this case, you will need the keyboard shortcut to switch the virtual terminal.
Conclusion
In Linux, the deallocvt command primarily deallocates the unused virtual terminals. It helps prevent unattended resource consumption. However, with the advancement in system management systems and the introduction of systemd, resource management has become more efficient.
This guide covers the syntax of the deallocvt command and its usage in Linux.