deallocvt
Deallocate unused virtual consoles
SYNOPSIS
deallocvt [n]
PARAMETERS
n
Virtual terminal number (typically 1-63) to deallocate if unused. Omitting deallocates all unused VTs.
DESCRIPTION
deallocvt is a Linux utility designed to free system memory by deallocating unused virtual terminals (VTs), also known as virtual consoles. These VTs allow switching between multiple text-based console sessions using key combinations like Ctrl+Alt+F1 to F12, providing independent shell environments without a graphical desktop.
The Linux kernel typically preallocates a fixed number of VTs (often 6 active plus up to 63 total), each reserving memory for framebuffers, font tables, cursor positions, and keyboard states—even if never activated. On memory-constrained systems like servers, embedded devices, or minimal installations, this can waste kilobytes per VT. deallocvt uses kernel ioctl calls on /dev/tty0 (the console master) to release these resources for unused VTs, returning memory to the system pool.
Run as root via sudo, the command safely ignores active VTs to avoid disrupting sessions. Without arguments, it targets all unused VTs; specifying a number focuses on one. This optimizes boot-time memory usage, especially after switching to a graphical session (e.g., via getty or systemd) where extra consoles remain dormant.
Benefits include reduced RAM footprint (e.g., ~4-64KB per VT depending on config) and cleaner resource management. It's common in init scripts or sysadmin toolkits for headless systems. Note: Effects are visible via free -h or dmesg, and reallocation occurs on demand.
CAVEATS
Requires root privileges (use sudo).
Does nothing to active/in-use VTs.
Kernel must have VT_CONSOLE enabled (standard).
Ineffective if all VTs are allocated or in use.
Modern distros auto-manage; rarely needed on desktops.
EXAMPLES
sudo deallocvt
Deallocates all unused VTs.
sudo deallocvt 7
Deallocates VT 7 if unused.
Check VTs: ls /sys/class/tty/tty*
KERNEL INTERACTION
Issues VT_DISALLOCATE ioctl(2) to /dev/tty0. See console_ioctl(4) for details.
HISTORY
Originated in the early 1990s kbd package by Risto Kankkunen and H. Peter Anvin for Linux console tools. Evolved with kernel VT subsystem (since Linux 1.x). Now in kbd-2.x releases; integrated into major distros like Debian/Ubuntu for backward compatibility.


