This tutorial explains Linux “fgconsole” command, options and its usage with examples.
If the active Virtual Terminal is /dev/ttyN, then prints N on standard output.
If the who command shows that
# who abc tty7 2013-12-23 02:02 (:0) abc pts/1 2013-12-24 11:04 (:0)
Then the fgconsole will output 7 as active terminal is tty7
# fgconsole 7
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.