I want to know on which virtual console the X11 is runnning. Of course, I can know it by invoking the ps command and watching the process tree. Or, I can know it by pressing ctrl+alt+F1, ctrl+alt+F2, ... But it is nice if there is an easier way.
When the system is in CUI mode, I can know it by the tty command. But under X11, the tty command tells me such as /dev/pts/0 and it doesn't seem to be a clue to the virtual console. Is there is any connection between tty* and pst/*?
In my environment, X11 is usually running on tty1. But in some rare case, it runs on another console. If I can know the console easily, it helps me a lot.
P.S.
Recently I knew the following fact:
On machies using systemd, the environment variable $XDG_VTNR is set to the number of the virtual console.