How to disable the screen (Linux without X)

15

8

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.

mnml

Posted 2009-08-28T23:55:51.650

Reputation: 1 391

If you have no Xserver installed, then what exactly do you want to disable? Can you explain what you want a bit more? – Telemachus – 2009-08-29T00:41:41.727

1What exactly are you talking about? please clarify – hasen – 2009-08-29T01:37:16.100

@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. – Telemachus – 2009-08-29T02:13:29.847

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 ;-) – mnml – 2009-08-29T15:30:49.060

Answers

14

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.

user4358

Posted 2009-08-28T23:55:51.650

Reputation:

1xset require Xserver unfortunately

The program 'xset' is currently not installed. You can install it by typing: apt-get install x11-xserver-utils – mnml – 2009-08-29T15:32:30.913

1With setterm -powersave on, I get cannot (un)set powersave mode – IanVaughan – 2011-11-01T20:45:24.447

6

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.

Stian Ellingsen

Posted 2009-08-28T23:55:51.650

Reputation: 146

I am using ubuntu server, and this is the only way I found to turn off display without x. Thank you! – user180574 – 2018-08-21T15:36:51.583

2one 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. – Bobby – 2011-12-30T20:59:42.837

1

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

05M4R

Posted 2009-08-28T23:55:51.650

Reputation: 11

1

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.

Ryan C. Thompson

Posted 2009-08-28T23:55:51.650

Reputation: 10 085

0

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 ""

sanmai

Posted 2009-08-28T23:55:51.650

Reputation: 622

0

If you have a serial port on your machine you could run it headless.

Do a web search for "linux serial console howto".

joe

Posted 2009-08-28T23:55:51.650

Reputation: 91

0

In answer to your question,

setterm -blank 0

should do it. Note that this will need to be done for each login tty.

weasel5i2

Posted 2009-08-28T23:55:51.650

Reputation: 101