LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Determining the Active Virtual Console (http://www.linuxquestions.org/questions/linux-general-1/determining-the-active-virtual-console-318798/)

MasterPi 04-30-2005 01:21 PM

Determining the Active Virtual Console
 
This may be a really stupid question but does anyone know how to tell which virtual console / screen is currently being displayed on screen by a script. I'm writing a cron script to do some things when it detects a network connection but some of the things (like running evolution) depend on the DISPLAY being set. i'm currently just using "who" and awking for my username and the console, but it would be nice to know which display is actually active, since i sometimes log in on more than one.

homey 04-30-2005 05:34 PM

Run the command: fgconsole
7 is for X
1-6 is cli

MasterPi 05-02-2005 01:39 PM

thank you! i knew it was probably something simple. one more thing: any way to determine the X display from this?

homey 05-02-2005 01:51 PM

Do you mean something like ...
echo $DISPLAY

MasterPi 05-02-2005 04:31 PM

umm, no... if you read the first post you would see that i was trying to set DISPLAY. i was wondering if there was a way to determine which X screen was running on a given VC

neo 05-02-2005 11:11 PM

xdpyinfo | grep display


All times are GMT -5. The time now is 03:38 PM.