Turn off monitor using command line












45














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








  • 1




    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






  • 1




    @WarriorIng64: it is a laptop
    – enzotib
    Sep 25 '11 at 8:39
















45














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








  • 1




    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






  • 1




    @WarriorIng64: it is a laptop
    – enzotib
    Sep 25 '11 at 8:39














45












45








45


31





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















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?







server display monitor x11






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 24 '11 at 20:53









enzotib

62.7k6132154




62.7k6132154










asked Sep 24 '11 at 20:49









AngryBird

226143




226143












  • 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








  • 1




    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






  • 1




    @WarriorIng64: it is a laptop
    – enzotib
    Sep 25 '11 at 8:39


















  • 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








  • 1




    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






  • 1




    @WarriorIng64: it is a laptop
    – enzotib
    Sep 25 '11 at 8:39
















Do you have an X server installed? And it is running?
– enzotib
Sep 24 '11 at 20:55




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






@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






1




1




Try running this first: export DISPLAY=:0.0
– RobinJ
Sep 24 '11 at 21:00




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




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




1




1




@WarriorIng64: it is a laptop
– enzotib
Sep 25 '11 at 8:39




@WarriorIng64: it is a laptop
– enzotib
Sep 25 '11 at 8:39










6 Answers
6






active

oldest

votes


















49














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



















  • 2




    You probably then want to alias this lot to something handy.
    – Danny Staple
    Sep 24 '11 at 21:33






  • 1




    vbetool is available via sudo apt-get install vbetool
    – David Clarke
    Mar 8 '14 at 6:21






  • 1




    In my case this command really turned the display off and not the xset one
    – golimar
    Feb 10 '17 at 16:58










  • Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
    – danba
    Mar 4 '18 at 20:05










  • @enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
    – andras.tim
    Mar 5 '18 at 8:57



















26














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























  • How do I know which screen is which
    – Karl Morrison
    Jul 30 '17 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
    – stiemannkj1
    Aug 4 '17 at 2:52












  • Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
    – Zmart
    Oct 31 '17 at 17:02






  • 1




    Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
    – Zmart
    Oct 31 '17 at 17:08



















18














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










  • @HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
    – Nishant
    Nov 13 '16 at 18:05












  • @Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
    – Harshith J.V.
    Apr 14 '17 at 5:00










  • If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
    – haytham-med haytham
    Nov 11 '17 at 6:36



















5














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





















  • I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
    – ThorSummoner
    Dec 12 '16 at 18:02



















5














I've just installed Ubuntu Server 18.04.1 (no GUI, X, nor anything graphical), and after breaking my back last night trying to turn off the screen I finally found the magic command:



setterm --blank 1


After execute the command the screen will turn off automatically every minute (if idle).



Enjoy!






share|improve this answer

















  • 1




    Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
    – zx485
    Sep 19 '18 at 21:23






  • 1




    Are you trying from a remote session?
    – Boy Graffity
    Sep 20 '18 at 1:41



















0














I use Ubuntu-MATE 16.04 and had problems with xset dpms .... Screen went briefly off, but came instantly back after 1 second.



What did work (if 'suspend' is okay for you in the sense of: black screens and also not doing any computations & services while you're away...) is:



systemctl suspend


(found this advice here)



Beyond command line, I enjoy using it as a custom shortcut from it (noone needs F1 'help' anyways… :+))



enter image description here






share|improve this answer

















  • 1




    I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
    – Sirens
    Dec 22 '18 at 23:20










  • True. My mistake.
    – Frank Nocke
    Dec 23 '18 at 20:58











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f62858%2fturn-off-monitor-using-command-line%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























6 Answers
6






active

oldest

votes








6 Answers
6






active

oldest

votes









active

oldest

votes






active

oldest

votes









49














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



















  • 2




    You probably then want to alias this lot to something handy.
    – Danny Staple
    Sep 24 '11 at 21:33






  • 1




    vbetool is available via sudo apt-get install vbetool
    – David Clarke
    Mar 8 '14 at 6:21






  • 1




    In my case this command really turned the display off and not the xset one
    – golimar
    Feb 10 '17 at 16:58










  • Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
    – danba
    Mar 4 '18 at 20:05










  • @enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
    – andras.tim
    Mar 5 '18 at 8:57
















49














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



















  • 2




    You probably then want to alias this lot to something handy.
    – Danny Staple
    Sep 24 '11 at 21:33






  • 1




    vbetool is available via sudo apt-get install vbetool
    – David Clarke
    Mar 8 '14 at 6:21






  • 1




    In my case this command really turned the display off and not the xset one
    – golimar
    Feb 10 '17 at 16:58










  • Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
    – danba
    Mar 4 '18 at 20:05










  • @enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
    – andras.tim
    Mar 5 '18 at 8:57














49












49








49






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














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














share|improve this answer



share|improve this answer








edited Mar 7 '18 at 8:08

























answered Sep 24 '11 at 21:29









enzotib

62.7k6132154




62.7k6132154








  • 2




    You probably then want to alias this lot to something handy.
    – Danny Staple
    Sep 24 '11 at 21:33






  • 1




    vbetool is available via sudo apt-get install vbetool
    – David Clarke
    Mar 8 '14 at 6:21






  • 1




    In my case this command really turned the display off and not the xset one
    – golimar
    Feb 10 '17 at 16:58










  • Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
    – danba
    Mar 4 '18 at 20:05










  • @enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
    – andras.tim
    Mar 5 '18 at 8:57














  • 2




    You probably then want to alias this lot to something handy.
    – Danny Staple
    Sep 24 '11 at 21:33






  • 1




    vbetool is available via sudo apt-get install vbetool
    – David Clarke
    Mar 8 '14 at 6:21






  • 1




    In my case this command really turned the display off and not the xset one
    – golimar
    Feb 10 '17 at 16:58










  • Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
    – danba
    Mar 4 '18 at 20:05










  • @enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
    – andras.tim
    Mar 5 '18 at 8:57








2




2




You probably then want to alias this lot to something handy.
– Danny Staple
Sep 24 '11 at 21:33




You probably then want to alias this lot to something handy.
– Danny Staple
Sep 24 '11 at 21:33




1




1




vbetool is available via sudo apt-get install vbetool
– David Clarke
Mar 8 '14 at 6:21




vbetool is available via sudo apt-get install vbetool
– David Clarke
Mar 8 '14 at 6:21




1




1




In my case this command really turned the display off and not the xset one
– golimar
Feb 10 '17 at 16:58




In my case this command really turned the display off and not the xset one
– golimar
Feb 10 '17 at 16:58












Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
– danba
Mar 4 '18 at 20:05




Strangely enough the command turns off 2 of 3 displays, the third remaining white for a while before having the machine reboot on its own if the command was executed over ssh.
– danba
Mar 4 '18 at 20:05












@enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
– andras.tim
Mar 5 '18 at 8:57




@enzotib, I clicked accidentally to downvote, sorry. Please edit a bit the answer to I can remove the downvote.
– andras.tim
Mar 5 '18 at 8:57













26














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























  • How do I know which screen is which
    – Karl Morrison
    Jul 30 '17 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
    – stiemannkj1
    Aug 4 '17 at 2:52












  • Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
    – Zmart
    Oct 31 '17 at 17:02






  • 1




    Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
    – Zmart
    Oct 31 '17 at 17:08
















26














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























  • How do I know which screen is which
    – Karl Morrison
    Jul 30 '17 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
    – stiemannkj1
    Aug 4 '17 at 2:52












  • Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
    – Zmart
    Oct 31 '17 at 17:02






  • 1




    Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
    – Zmart
    Oct 31 '17 at 17:08














26












26








26






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














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














share|improve this answer



share|improve this answer








edited Jul 2 '12 at 10:54









Eliah Kagan

81.4k20227364




81.4k20227364










answered Mar 28 '12 at 17:45









Glauber Cardoso

43942




43942












  • How do I know which screen is which
    – Karl Morrison
    Jul 30 '17 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
    – stiemannkj1
    Aug 4 '17 at 2:52












  • Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
    – Zmart
    Oct 31 '17 at 17:02






  • 1




    Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
    – Zmart
    Oct 31 '17 at 17:08


















  • How do I know which screen is which
    – Karl Morrison
    Jul 30 '17 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
    – stiemannkj1
    Aug 4 '17 at 2:52












  • Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
    – Zmart
    Oct 31 '17 at 17:02






  • 1




    Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
    – Zmart
    Oct 31 '17 at 17:08
















How do I know which screen is which
– Karl Morrison
Jul 30 '17 at 15:26




How do I know which screen is which
– Karl Morrison
Jul 30 '17 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
– stiemannkj1
Aug 4 '17 at 2:52






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
– stiemannkj1
Aug 4 '17 at 2:52














Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
– Zmart
Oct 31 '17 at 17:02




Be careful with this. I'm unable to turn my monitor back on with a test machine after issuing force off
– Zmart
Oct 31 '17 at 17:02




1




1




Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
– Zmart
Oct 31 '17 at 17:08




Update: Pulling out and replugging all cables (including power) on the monitor has remedied the situation.
– Zmart
Oct 31 '17 at 17:08











18














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










  • @HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
    – Nishant
    Nov 13 '16 at 18:05












  • @Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
    – Harshith J.V.
    Apr 14 '17 at 5:00










  • If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
    – haytham-med haytham
    Nov 11 '17 at 6:36
















18














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










  • @HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
    – Nishant
    Nov 13 '16 at 18:05












  • @Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
    – Harshith J.V.
    Apr 14 '17 at 5:00










  • If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
    – haytham-med haytham
    Nov 11 '17 at 6:36














18












18








18






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












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












share|improve this answer



share|improve this answer










answered Jun 21 '12 at 9:53









Harshith J.V.

28927




28927












  • 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










  • @HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
    – Nishant
    Nov 13 '16 at 18:05












  • @Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
    – Harshith J.V.
    Apr 14 '17 at 5:00










  • If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
    – haytham-med haytham
    Nov 11 '17 at 6:36


















  • 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










  • @HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
    – Nishant
    Nov 13 '16 at 18:05












  • @Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
    – Harshith J.V.
    Apr 14 '17 at 5:00










  • If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
    – haytham-med haytham
    Nov 11 '17 at 6:36
















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




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




Hmm strange. Try --on instead of --auto
– Harshith J.V.
Feb 23 '15 at 2:58












@HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
– Nishant
Nov 13 '16 at 18:05






@HarshithJ.V. this is a good answer! Its better than the xset because xset turns on if you just press the touchpad etc. Btw hope you remember me from your previous company :-)
– Nishant
Nov 13 '16 at 18:05














@Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
– Harshith J.V.
Apr 14 '17 at 5:00




@Nishant Thanks for compliments. Strangely I don't remember you. Please ping me on any other social media as we can't chat over as its against the rules.
– Harshith J.V.
Apr 14 '17 at 5:00












If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
– haytham-med haytham
Nov 11 '17 at 6:36




If you got crtc error, then type "chvt 7" before xrandr command, so that it reads "chvt 7 && xrandr -d :0 --output eDP1 --auto"
– haytham-med haytham
Nov 11 '17 at 6:36











5














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





















  • I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
    – ThorSummoner
    Dec 12 '16 at 18:02
















5














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





















  • I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
    – ThorSummoner
    Dec 12 '16 at 18:02














5












5








5






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












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












share|improve this answer



share|improve this answer










answered Jan 19 '16 at 0:16









Darksworm

5911




5911












  • I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
    – ThorSummoner
    Dec 12 '16 at 18:02


















  • I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
    – ThorSummoner
    Dec 12 '16 at 18:02
















I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
– ThorSummoner
Dec 12 '16 at 18:02




I was testing this, turning off a screen this way is more like disabling it, eg, the screen is still powered on. Its just not used. The --off'd screen cannot be turned back on with the screen's power button (because its still on / was never off). It also messed with my desktop display settings, (from extended desktop to mirrored displays). If this was done to turn both displays off, I'm not sure it would be easy to turn them back on without logging in to TTY and clearing the monitors.xml file wherever it is. The more you know.
– ThorSummoner
Dec 12 '16 at 18:02











5














I've just installed Ubuntu Server 18.04.1 (no GUI, X, nor anything graphical), and after breaking my back last night trying to turn off the screen I finally found the magic command:



setterm --blank 1


After execute the command the screen will turn off automatically every minute (if idle).



Enjoy!






share|improve this answer

















  • 1




    Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
    – zx485
    Sep 19 '18 at 21:23






  • 1




    Are you trying from a remote session?
    – Boy Graffity
    Sep 20 '18 at 1:41
















5














I've just installed Ubuntu Server 18.04.1 (no GUI, X, nor anything graphical), and after breaking my back last night trying to turn off the screen I finally found the magic command:



setterm --blank 1


After execute the command the screen will turn off automatically every minute (if idle).



Enjoy!






share|improve this answer

















  • 1




    Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
    – zx485
    Sep 19 '18 at 21:23






  • 1




    Are you trying from a remote session?
    – Boy Graffity
    Sep 20 '18 at 1:41














5












5








5






I've just installed Ubuntu Server 18.04.1 (no GUI, X, nor anything graphical), and after breaking my back last night trying to turn off the screen I finally found the magic command:



setterm --blank 1


After execute the command the screen will turn off automatically every minute (if idle).



Enjoy!






share|improve this answer












I've just installed Ubuntu Server 18.04.1 (no GUI, X, nor anything graphical), and after breaking my back last night trying to turn off the screen I finally found the magic command:



setterm --blank 1


After execute the command the screen will turn off automatically every minute (if idle).



Enjoy!







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 19 '18 at 20:52









Boy Graffity

5112




5112








  • 1




    Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
    – zx485
    Sep 19 '18 at 21:23






  • 1




    Are you trying from a remote session?
    – Boy Graffity
    Sep 20 '18 at 1:41














  • 1




    Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
    – zx485
    Sep 19 '18 at 21:23






  • 1




    Are you trying from a remote session?
    – Boy Graffity
    Sep 20 '18 at 1:41








1




1




Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
– zx485
Sep 19 '18 at 21:23




Executing the above command I get: "setterm: terminal xterm-256color does not support --blank". What can be wrong?
– zx485
Sep 19 '18 at 21:23




1




1




Are you trying from a remote session?
– Boy Graffity
Sep 20 '18 at 1:41




Are you trying from a remote session?
– Boy Graffity
Sep 20 '18 at 1:41











0














I use Ubuntu-MATE 16.04 and had problems with xset dpms .... Screen went briefly off, but came instantly back after 1 second.



What did work (if 'suspend' is okay for you in the sense of: black screens and also not doing any computations & services while you're away...) is:



systemctl suspend


(found this advice here)



Beyond command line, I enjoy using it as a custom shortcut from it (noone needs F1 'help' anyways… :+))



enter image description here






share|improve this answer

















  • 1




    I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
    – Sirens
    Dec 22 '18 at 23:20










  • True. My mistake.
    – Frank Nocke
    Dec 23 '18 at 20:58
















0














I use Ubuntu-MATE 16.04 and had problems with xset dpms .... Screen went briefly off, but came instantly back after 1 second.



What did work (if 'suspend' is okay for you in the sense of: black screens and also not doing any computations & services while you're away...) is:



systemctl suspend


(found this advice here)



Beyond command line, I enjoy using it as a custom shortcut from it (noone needs F1 'help' anyways… :+))



enter image description here






share|improve this answer

















  • 1




    I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
    – Sirens
    Dec 22 '18 at 23:20










  • True. My mistake.
    – Frank Nocke
    Dec 23 '18 at 20:58














0












0








0






I use Ubuntu-MATE 16.04 and had problems with xset dpms .... Screen went briefly off, but came instantly back after 1 second.



What did work (if 'suspend' is okay for you in the sense of: black screens and also not doing any computations & services while you're away...) is:



systemctl suspend


(found this advice here)



Beyond command line, I enjoy using it as a custom shortcut from it (noone needs F1 'help' anyways… :+))



enter image description here






share|improve this answer












I use Ubuntu-MATE 16.04 and had problems with xset dpms .... Screen went briefly off, but came instantly back after 1 second.



What did work (if 'suspend' is okay for you in the sense of: black screens and also not doing any computations & services while you're away...) is:



systemctl suspend


(found this advice here)



Beyond command line, I enjoy using it as a custom shortcut from it (noone needs F1 'help' anyways… :+))



enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 22 '18 at 8:10









Frank Nocke

473421




473421








  • 1




    I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
    – Sirens
    Dec 22 '18 at 23:20










  • True. My mistake.
    – Frank Nocke
    Dec 23 '18 at 20:58














  • 1




    I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
    – Sirens
    Dec 22 '18 at 23:20










  • True. My mistake.
    – Frank Nocke
    Dec 23 '18 at 20:58








1




1




I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
– Sirens
Dec 22 '18 at 23:20




I don't really see this as an acceptable solution. The question was how to turn off the monitor of a server. Your answer sleeps the computer which isn't something you'd ever want on a server
– Sirens
Dec 22 '18 at 23:20












True. My mistake.
– Frank Nocke
Dec 23 '18 at 20:58




True. My mistake.
– Frank Nocke
Dec 23 '18 at 20:58


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f62858%2fturn-off-monitor-using-command-line%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido