Get Active Linux Virtual Console

From Leo's Notes
Revision as of 04:23, 24 February 2017 by Leo (talk | contribs) (Text replacement - "{{Highlight|lang=bash" to "{{highlight|lang=terminal")
This page was last edited on 24 February 2017, at 04:23.

To get the active virtual terminal/console in use under Linux, use the fgconsole command, or run

cat /sys/class/tty/tty0/active
fgconsole requires root
The fgconsole requires root access or the ability to read /dev/tty0 as the person running the program.