This question already has an answer here:

I would like to check if a monitor is turned on so that I can switch the output to it.

xrandr --query

will show all connected displays no matter if they are turned on or not

xrandr --listmonitors

will only list the monitors that are displaying something.

marked as duplicate by Rui F Ribeiro, roaima, GAD3R, elbarna, Jeff Schaller Dec 22 '18 at 1:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


https://stackoverflow.com/questions/3433203/how-to-determine-if-lcd-monitor-is-turned-on-from-linux-command-line found shell script code to check, a la:

#!/bin/bash export DISPLAY=:0.0

 if [ $# -eq 0 ]; then   
 echo usage: $(basename $0) "on|off|status"    
 exit 1  

 if [ $1 = "off" ]; then   
  echo -en "Turning monitor off..."   
  xset dpms force off   
  echo -en "done.\nCheck:"  
  xset -q|grep "Monitor is"  

 elif [ $1 = "on" ]; then   
 echo -en "Turning monitor on..."
 xset dpms force on   
 echo -en "done.\nCheck:"   
 xset -q|grep "Monitor is"  

 elif [ $1 = "status" ]; then   
 xset -q|sed -ne 's/^[ ]*Monitor is //p' 

 echo usage: $(basename $0) "on|off|status"   

  • That dosen't seem to yield the results I'm looking for. What I wanna do is run a script that only executes when a second Monitor is Physically turned on. This Script will always return the status "on" when one Monitor is on and in usage. – schtiehve Dec 21 '18 at 18:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.