Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Do you have an X server installed? And it is running? – enzotib Sep 24 '11 at 20:55
@enzotib I do believe it is installed. As for it running, I am not sure. How can I check? – AngryBird Sep 24 '11 at 20:56
Try running this first: export DISPLAY=:0.0 – RobinJ Sep 24 '11 at 21:00
Non null output from dpkg -l | grep xserver-xorg to be installed. Non null output from pgrep -fl X to be running. By the way, if running you should be in a graphical session. – enzotib Sep 24 '11 at 21:03
@WarriorIng64: it is a laptop – enzotib Sep 25 '11 at 8:39

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'
share|improve this answer
You probably then want to alias this lot to something handy. – Danny Staple Sep 24 '11 at 21:33
vbetool is available via sudo apt-get install vbetool – David Clarke Mar 8 '14 at 6:21

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 
share|improve this answer

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
share|improve this answer
I have 3 Monitors, 1 VGA, 1 DVI and 1 HDMI. When i ran: xrandr --output VGA1 --auto, it turned the VGA on, but it cloned the DVI monitor. – ThiagoPonte Feb 23 '15 at 0:43
Hmm strange. Try --on instead of --auto – Harshith J.V. Feb 23 '15 at 2:58

If you have multiple monitors use this:

Turning off your second monitor:
(Assuming CRT-0 is your left monitor and CRT-1 is your right monitor)
xrandr --output CRT-1 --off
Turning on your second monitor:
xrandr --output CRT-1 --right-of CRT-0 --auto
This way xrandr knows not to duplicate the first screen.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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