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? 94.6k 12 12 gold badges 169 169 silver badges 181 181 bronze badges asked Sep 24, 2011 at 20:49 1,241 2 2 gold badges 9 9 silver badges 3 3 bronze badges Do you have an X server installed? And it is running? Commented Sep 24, 2011 at 20:55 Try running this first: export DISPLAY=:0.0 Commented Sep 24, 2011 at 21:00 Maybe I'm missing something here, but doesn't the monitor have a power button? Commented Sep 25, 2011 at 1:06 @WarriorIng64: it is a laptop Commented Sep 25, 2011 at 8:39 Ah, sorry. missed that part. Commented Sep 25, 2011 at 18:03

11 Answers 11

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' 
answered Sep 24, 2011 at 21:29 94.6k 12 12 gold badges 169 169 silver badges 181 181 bronze badges You probably then want to alias this lot to something handy. Commented Sep 24, 2011 at 21:33 vbetool is available via sudo apt-get install vbetool Commented Mar 8, 2014 at 6:21 In my case this command really turned the display off and not the xset one Commented Feb 10, 2017 at 16:58

Ubuntu 20.04 LTS: vbetool dpms off does not work and says mmap /dev/zero: Operation not permitted and then Failed to initialise LRMI (Linux Real-Mode Interface). . Tried on X11 as root and via ssh as root and on text console as root.

Commented Feb 9, 2021 at 19:53 I confirm that this command doesn't work on Ubuntu server 20.04 @Tino Commented Mar 13, 2021 at 8:02

Try these commands.

xset -display :0.0 dpms force off 
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 
119k 57 57 gold badges 323 323 silver badges 504 504 bronze badges answered Mar 28, 2012 at 17:45 Glauber Cardoso Glauber Cardoso 795 5 5 silver badges 2 2 bronze badges How do I know which screen is which Commented Jul 30, 2017 at 15:26

The following worked for me (also partially inspired by @enzotib's answer): xset -display $DISPLAY dpms force off; read temp; xset -display $DISPLAY dpms force on

Commented Aug 4, 2017 at 2:52

Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off

Commented Oct 31, 2017 at 17:02

Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.

Commented Oct 31, 2017 at 17:08

Ubuntu 20.04 LTS does not work: server does not have extension for dpms option . Blanking via keyboard shortcut (Fn+F6 in my case) works (a bit unreliable, releasing Fn often unblanks screen again). But I need a solution which works via ssh when the Laptop's keyboard is out of reach. (It's really annoying if you wake up in bed because the Laptop lights the room. Just a short voice command could invoke ssh to stop the Laptop burning! Note that I disable screensavers on consoles, as there is only one thing which is even more annoying than wrong time console blanking: CapsLock!)

Commented Feb 9, 2021 at 18:51

The xset command mentioned in other answers will turn off all the monitors if you have multiple monitor setup. However if you want turn off only one or some of the monitor you should use xrandr .

First run xrandr -q command, which will list all the monitors and its current display settings. At the start of each monitor details you will find monitor name set by the system. You have to keep track of that.

I have two monitors (one is connected to DVI port and other to VGA port) and when I run the command I see this:

Screen 0: minimum 320 x 200, current 1360 x 768, maximum 2726 x 2726 DFP1 connected 1360x768+0+0 (normal left inverted right x axis y axis) 304mm x 228mm 1360x768 59.7*+ . (more details are shown here, but I have hidden it) CRT1 connected 1360x768+0+0 (normal left inverted right x axis y axis) 410mm x 230mm 1360x768 59.8*+ 60.0 . (more details are shown here, but I have hidden it) 

In this output, DVI port connected monitor is labelled as DFP1 and other one as CRT1 . So if I want turn off the secondary monitor(i.e., CRT1 ) I have run this command:

xrandr --output CRT1 --off 

if you want switch on that monitor again then you have run this command:

xrandr --output CRT1 --auto