chvt – change foreground virtual terminal

Changing virtual terminals is almost essential for the Linux system administrator. If you don’t know what I mean by this then try pressing CTRL+ALT+F5 once you are there press CTRL+RIGHT ARROW until you get back to your display (should be two or so times depending on your distribution)

Until a few minutes ago I didn’t know that this could be done by the command line. chvt is a nifty command to change virtual terminal. Basically all you have to do is type “chvt 2″ to change to tty2. I found it while I was looking for a solution to open up a view of other active terminals.

This could be handy if your on a laptop or your function keys are missing / broken.

In GNU/LINUX OS, be default, 6 virtual text mode console terminals
will be running. User can switch between this terminals using Left
Side Ctrl + Alt + FunKey(1 – 6).

chvt command is also used to switch between this terminals. It can
be used in shell scripts.


$ chvt 1 — Switch from current terminal to /dev/tty1.

$ chvt 2 — Switch from current terminal to /dev/tty2.

Read: man chvt

TIP: Screen Dump in Text console.

# sudo cat /dev/vcs2 > scrdump.txt — Take the screen dump of
/dev/tty2 in scrdump.txt file.