0

Turning off the monitor should be a really simple thing, but it isn't. I know that under Xserver, we have xset tool which allows us to turn off the screen via the following command:

$ xset dpms force off

But this doesn't work while logged in TTY.

I also know that there's setterm tool that can set some powersave options, for instance:

setterm --blank 5  --powersave powerdown --powerdown 0

So after 5mins since the last command typed into TTY console, the monitor will be powered off, but I need a command that can turn off it instantly. Something similar to xset. Is there something like that?

1 Answers1

3

There is an article here on this forum talking about disabling a monitor. This article goes further and discusses vbetool option.

# vbetool dpms off

This command turns off the monitor regardless of X is running or not. So, this is almost the answer I'm looking for. Now, let me explain that almost.

  • Yes, it turns off the screen instantly, but there's a little problem with turning it on again because when I press a key on my keyboard, it doesn't work. I have to type vbetool dpms on blindly so I could turn the monitor on. Is there a way to turn it on when a key is pressed? – Mikhail Morfikov Nov 11 '15 at 20:55
  • @MikhailMorfikov As I recall, TTY supports scripts. You can write a script to monitor keyboard events, and when a key is depressed and the monitor is off, then the script would turn the monitor back on. That gets more into programming and StackOverflow type of thing and less tweaking the OS, though. – Sarah Weinberger Nov 11 '15 at 21:10
  • Now, on modern Linux, it does not anymore the rights to do that stuff. It fails with (as root): mmap /dev/zero: Operation not permitted Failed to initialise LRMI (Linux Real-Mode Interface). – Golar Ramblar Dec 01 '23 at 15:11