Turn off monitor using command line
I am runnning Ubuntu Server on my laptop. There is really no reason for the screen to be on. I have been trying to use this command to turn the screen off:
sleep 1 && xset dpms force off
The problem is I get the following error
unable to open display "".
Any idea what is going on / what is wrong? Any other suggestions for how to do this?
Solution 1:
To turn off monitor in console, the command is the following:
sudo vbetool dpms off
To regain control of the console on pressing Enter key, I suggest
sudo sh -c 'vbetool dpms off; read ans; vbetool dpms on'
Solution 2:
Try these commands...
To Turn Off:
xset -display :0.0 dpms force off
To Turn On:
xset -display :0.0 dpms force on
If your display turns off and then immediately back on then try the following which adds a delay of 1 second before turning the screen off. This give a chance for all events to be processed by the X server before turning the display off.
sleep 1 && xset -display :0.0 dpms force off