In linux I can use the key combinations Alt-Ctrl-F1,Alt-Ctrl-F2... to switch to different tty1 as I could use man chvt.
using the command tty I also get displayed the teletype/linux virtual console I am on.
However if I am in xterm or in gnome-terminal tty will display the relevant pseude-terminal.
Given all that:
- How can I tell which is the currently "active"
tty(meaning it being displayed on the screen)?
This would be somewhat the solution (however it seems contorted and relies on loginctl logind, there must be a non-systemd to find out):
for sessionid in $(loginctl list-sessions --no-legend | awk '{ print $1 }'); do loginctl show-session -p State -p TTY $sessionid; done | grep "State=active" -B1 | head -n 1 | sed 's/.*=//g'