13

I like the 'Black Screen' screen-saver. Because it makes the monitor look like turned-off. But my CentOS takes minimum 1 min. to start it automatically.

Can I start it instantly from the terminal?

I sometimes need this feature while working with 2 monitors with two different OS. CentOS is on my VNC.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
MD. Mohiuddin Ahmed
  • 665
  • 3
  • 11
  • 20

4 Answers4

13

If all you want to do is blank the screen, as opposed to running a fancy animation or locking the screen, then xset can do it.

xset dpms force off

If you want to lock the display, you need a screen locking program, e.g. xscreensaver-command -lock -activate or gnome-screensaver -al or (for KDE4) qdbus org.freedesktop.ScreenSaver /ScreenSaver Lock.

If you want to turn off one monitor only, you can to it through xrandr (unless you're using a proprietary display driver, in which case you'll have the tools provided by NVidia/ATI).

xrandr --output DVI1 --off

This won't be undone by moving the mouse, you need to run xrandr --output DVI1 --auto to bring the monitor back.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
9

You can use xscreensaver-command:

$ xscreensaver-command -activate

or, with XScreenSaver 6 or later:

$ xscreensaver-command --activate

If it is not there on your system, on Debian derivatives you can install it with:

$ sudo apt-get install xscreensaver

On Fedora/CentOS/RHEL you install it with this command:

$ sudo yum install xscreensaver-base
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
tusharmakkar08
  • 1,805
  • 1
  • 22
  • 23
6

On modern distros you'd do xdg-screensaver activate

Atemu
  • 584
  • 4
  • 14
0

Per the other answer, I use:

xscreensaver-command -a

On Arch/Manjaro, I installed it from the AUR using:

$ yay -S xscreensaver
Jesse
  • 333
  • 4
  • 14