70

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?

6 Answers6

89

Try using

xset dpms force off

to force the screen to turn off.

wizlog
  • 13,573
Siva Charan
  • 4,959
31

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.

hamstar
  • 529
  • 8
  • 11
4

I use Alex Cabal script to turn my two monitors screens off and on and it works very fine for me.

#!/bin/bash

# turn screens off/on
# (ɔ) alex cabal

screenOffLockFile=/tmp/screen-off-lock

if [ -f $screenOffLockFile ];
then
    rm $screenOffLockFile
    notify-send "Screen on." -i /usr/share/icons/gnome/48x48/devices/display.png
else
    touch $screenOffLockFile
    sleep .5
    while [ -f  $screenOffLockFile ]
    do
        xset dpms force off
        sleep 2
    done
    xset dpms force on
fi
4

You can go to your distro's settings, and add a shortcut => putting the command - xset dpms force off, then put a hotkey(say F9). That's it, whenever you hit the hotkey, your monitor's screen will turn off

tavish
  • 41
3

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

danicotra
  • 2,036
2

slock locks the screen gracefully.