Answers:
是的,您可以使用chvt
命令。这需要sudo特权才能运行。
CHVT(1)
NAME
chvt - change foreground virtual terminal
SYNOPSIS
chvt N
DESCRIPTION
The command chvt N makes /dev/ttyN the foreground terminal.
(The corresponding screen is created if it did not exist yet.
To get rid of unused VTs, use deallocvt )
The key combination (Ctrl-)LeftAlt-FN (with N in the range 1-12) usually has a similar effect.
您可以通过fgconsole
命令找到当前使用的虚拟终端。这也需要sudo特权才能运行。
ioctl(fd,VT_ACTIVATE,screen_no)
调用。引用自:cs.cmu.edu/~joshuad/libretto.html