fgconsole Command in Linux

This tutorial explains Linux “fgconsole” command, options and its usage with examples.

fgconsole – print the number of the active VT.


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

Note: Join free Sanfoundry classes at Telegram or Youtube
# fgconsole

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.


Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.