Sunday, July 26, 2015

lock and swich off screen on linux, ununtu, centos

Method one:
Make a text file and call it 'switchOffScreen.sh' save it in home directory or other dir (folder).

Contents of file:

#!/bin/bash
gnome-screensaver-command -l
sleep 2
xset dpms force off


Give it execute permissions by command:

chmod +x ~/switchOffScreen.sh

Now make a short cut in keyboard to this script, call it when required.

Method two : 
Tested on ubuntu :
open keyboard short cuts, make a new shortcut with command : 

 gnome-screensaver-command -l | sleep 2 |  xset dpms force off

Add a shortcut, I overwrote Ctrl-Alt-L confirmed I want to over ride the default and now my screen goes off after I lock. Less power used. 

Followers