Lock your screen using command line
I read one article today and that was fantastic.I am sharing that article here hope you all like it.
Lock your Screen using command line in Fedora 10 and Ubuntu.
This command is extraordinary for who work on terminal continuously and want to step away for some movements.
NOTE –In this command, where you see “–lock”, it is really 2 hyphens with no spaces in between, followed by “lock” … – – lock. WordPress renders two hyphens put together as… –
When you execute above command then it will activate your screen saver and prompt for password to login.But as i metioned that command is pretty long so you need to create alias for that.To create alias Follow below method.
Open your .bashrc file into your favorite editor i am using vim as my editor.before editing file dont forget to make backup.
vim .bashrc (if you are not at home directory prompt then vim /home/<user-name>/.bashrc)
Now just move to end of file and paste below content.
alias lock=’gnome-screensaver-command –lock’
Save & Exit from File.
Now above commands tells your ubuntu or fedora that if you type in lock ,it actually executes gnome-screensaver-command –lock
Enjoy Lock Screen from Command Prompt