chvt

Switch the foreground virtual terminal

TLDR

Switch the console to TTY number N (requires root)
$ sudo chvt [N]

SYNOPSIS

chvt N

DESCRIPTION

chvt changes the foreground virtual terminal to terminal N. Virtual terminals (VTs) are the text consoles accessible via Ctrl+Alt+F1 through F7 on most Linux systems.This is equivalent to pressing Ctrl+Alt+FN but can be done programmatically or when keyboard shortcuts are unavailable.

PARAMETERS

N

The virtual terminal number to switch to (typically 1-7)

INSTALL

sudo apt install kbd
sudo dnf install kbd
sudo pacman -S kbd
sudo apk add kbd
sudo zypper install kbd
nix profile install nixpkgs#kbd

CAVEATS

Requires root privileges. The target VT must exist. On systems with graphical desktop, VT7 or VT1 is typically the X/Wayland session. Available VTs depend on system configuration.

SEE ALSO

fgconsole(1), deallocvt(1)