I would like to know if there is any way I can disable the screen on a linux distro I'm using Debian. I found a few way to do that with X installed, but not without X.
-
If you have no Xserver installed, then what exactly do you want to disable? Can you explain what you want a bit more?– TelemachusAug 29, 2009 at 0:41
-
1What exactly are you talking about? please clarify– hasenAug 29, 2009 at 1:37
-
@Mnml: in a comment below, you mention a laptop and turning off the screen. I'm not sure you want to create a headless server on a laptop. This strikes me as pretty counter-intuitive.– TelemachusAug 29, 2009 at 2:13
-
2@Telemachus: I'm using a old tablet as a little "home" server, it's fast enough for the services I'm running on It (dovecot etc) and it's not using a lot of electricity... It would be even better without the screen ;-)– mnmlAug 29, 2009 at 15:30
7 Answers
You can turn off the screen on your laptop using the xset command:
xset dpms force off
DPMS is Display Power Management Signaling, a standard to reduce power consumption in monitors. xset is of course an X utility. If you need to accomplish this without X involved, use setterm:
setterm -powerdown 1
The full list of options to manipulate your screen:
xset -dpms # Disable DPMS
xset +dpms # Enable DPMS
xset s off # Disable screen blanking
xset s 150 # Blank the screen after 150 seconds
xset dpms 300 600 900 # Set standby, suspend, & off times (in seconds)
xset dpms force standby # Immediately go into standby mode
xset dpms force suspend # Immediately go into suspend mode
xset dpms force off # Immediately turn off the monitor
xset -q # Query current settings
setterm -blank 10 # Blank the screen in 10 minutes
setterm -powersave on # Put the monitor into VESA power saving mode
setterm -powerdown 20 # Set the VESA powerdown to 20 minutes
These are all duly explained in the Battery Powered Linux Mini-HOWTO.
-
1xset require Xserver unfortunately The program 'xset' is currently not installed. You can install it by typing: apt-get install x11-xserver-utils– mnmlAug 29, 2009 at 15:32
-
1
-
-
The setterm command definitely works. Anyway to execute on startup or just create a sysv startup script? Jul 20, 2021 at 6:51
Check out vbetool. You can turn off the screen with:
vbetool dpms off
The only problem I'm having with this is that the screen doesn't turn back on automatically on e.g. keyboard input. You have to do it manually by typing it in blindly or via SSH:
vbetool dpms on
On Debian Squeeze, vbetool is used in /etc/acpi/lid.sh when X is not available.
-
3one could write a little script which blanks the screen, waits for input and then reenables it. Something like
vbetool dpms off && read -s -n 1 && vbetool dpms on
.– BobbyDec 30, 2011 at 20:59 -
1I am using ubuntu server, and this is the only way I found to turn off display without x. Thank you! Aug 21, 2018 at 15:36
I'm not sure which package provides it, but some ACPI-related package includes scripts for blanking the screen based on whether the laptop's lid is open. Although now that I look at the script itself (/etc/acpi/lid.sh
), it seems to only work on X. However, the point is that it provides a framework for triggering actions on lid open/close events. You could modify the script to use setterm, and it might do what you want.
In Kali GNU/Linux Rolling 64-bit check if xset -q
shows like this:
DPMS (Energy Star):
Standby: 600 Suspend: 600 Off: 600
Setting all of them to 0 works for me. Do it with this command line:
xset dpms 0 0 0
In answer to your question,
setterm -blank 0
should do it. Note that this will need to be done for each login tty.
If you by chance need to turn off a display remotely, e.g. on a laptop when logged in over SSH...
DISPLAY=":0" xset dpms force off
Unless you specify a DISPLAY
variable, xset would fail with:
xset: unable to open display ""
this should do it for ubuntu server
sudo setterm --powersave off --blank 0
it worked on "ubuntu-server 16.04"