3

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.

7

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.

  • That was awesome :) . I didn't knew about that . – tusharmakkar08 Jun 14 '13 at 5:09
  • 1
    But if you're concerned about security (and you should be) then you should use xlock or xscreensaver before turning off the display. (Perhaps make a wrapper that does both.) – bahamat Jun 14 '13 at 5:13
  • @bahamat For the use case “working with 2 monitors with two different OS”, locking doesn't seem useful, but I've edited it in anyway. – Gilles 'SO- stop being evil' Jun 14 '13 at 10:11
  • @Gilles: I've got to try it. But the worstation is at my office and I use windows when I'm home.I have to wait this weekend :( .Thanks ... and I'm sorry for being late. – MD. Mohiuddin Ahmed Jun 14 '13 at 11:44
  • @Gilles: Hi , Gilles... It gives this message : server does not have extension for dpms option xset: unknown option force ' – MD. Mohiuddin Ahmed Jun 16 '13 at 7:21
5

You can use xscreensaver command .

$ xscreensaver-command -activate

If it is not there on your system install it by :

$ sudo apt-get install xscreensaver

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

$ sudo yum install xscreensaver-base
  • If you use gnome, you can use gnome-screensaver-command --activate. No need to install xscreensaver. – andcoz Jun 13 '13 at 5:58
  • When I tried using gnome-screensaver-command --activate my screen got locked instead of the activation of screensaver .I am using Linux Mint 14 Nadia.Do you have any idea why is it so ? – tusharmakkar08 Jun 13 '13 at 6:03
  • Hey Tushar Makkar , it shows 'apt-get: command not found' !! – MD. Mohiuddin Ahmed Jun 13 '13 at 6:45
  • Hi , for centOS/RHEL you need to use yum install "package name" that is in this case use su -c "yum install xscreensaver" to install Xscreensaver . For Debian based linux we use apt-get. – tusharmakkar08 Jun 13 '13 at 6:52
  • But , it displays : 'No package xscreensaver available.Error: Nothing to do' – MD. Mohiuddin Ahmed Jun 13 '13 at 7:50

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.