17

Since my monitor takes an awful lot of time to turn back on after being physically turned off, I'm looking for a command or a simple utility to turn off my screen with a shortcut. Setting a black screensaver is not satisfactory; I want the screen to "hibernate" (the same effect I would get by turning off the computer while leaving the screen physically on).

The same question for Windows: How can I make my screen blank by a shortcut?

  • Press STRG a than k and than y – Daniel Jan 4 '12 at 21:25
25

Try using

xset dpms force off

to force the screen to turn off.

  • That's really great. For the OP though, when a key is pressed, it turns the screen back on. I'm not sure if that's desirable. – FakeRainBrigand Jan 4 '12 at 21:18
  • 4
    Sometimes works better if you do sleep 1 ; xset dpms force off otherwise remnants of the last keyboard activity (I guess) sometimes turns the screen back on immediately. – Mat Jan 4 '12 at 21:19
  • This is exactly what I've been looking for. Thanks @siva-charan. The only thing I was wondering is how I could ask for a password when I wake the screen. I'm basically using a shortcut to turn off my screen and I would like it to ask for password on wake. – Isabel Inc Feb 6 '17 at 0:07
11

I made a file called /home/me/bin/blank and made it executable chmod +x blank with the following in it:

#!/bin/bash
sleep 1; xset dpms force off

Then I set a shortcut in Gnome3 application "keyboard" (gnome-control-center keyboard) to run that script when I push CTRL+ALT+Q.

Man I love linux.

  • I liked this :) Just as a little addendum, take a look at systembash.com/… to see how you could set up a timed use of this trick and turn your monitor on/off at specified time – danicotra Jun 25 '17 at 11:01
  • you mean turning your monitor on at a specified time with cron? – frankster Feb 2 '18 at 17:20
2

slock locks the screen gracefully.

  • I just installed it and screen totally locked without turning LED off! and seems there isn't any way to unlock screen again :| – Morteza Ziaeemehr Nov 28 '15 at 14:29
  • 1
    @MortezaZiaeemehr It's very minimal. Just enter your password and press Enter. – octosquidopus Dec 17 '15 at 1:58
0

As a premise, I personally prefer hamstar/Siva Charan solution. Anyway, I know another possible way could be a script that sets screensaver to blank and then make it start:

rem #!/bin/bash

xset s blank ; sleep 1 ; xset s activate

So as just not to let unspoken things

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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