Wednesday, August 24, 2011

Locking screen on Mac from Terminal

I do all my work from a terminal on my mac. I try to use as much keyboard as possible for everything. Whenever I need to lock my screen which I say many times in a day I either use hot corners or key chain options. Then I thought why not from terminal it self. In case you are also interested to know how to do this, here is how I did it.

Open up a terminal and do these commands. The last command "schlock" will lock the screen whenever you execute it from the terminal. Of course, you can give what ever name you like. Make sure that it doesn't have space between the words, for example "screen lock". You can always give something like "screen_lock", etc.

$ echo "alias scrlock='/System/Library/CoreServices/\"Menu Extras\"/\
User.menu/Contents/Resources/CGSession -suspend'" >> ~/.bashrc
$ source ~/.bashrc
$ scrlock

No comments:

PBS Script Generator: Interdependent dropdown/select menus in Javascript

PBS SCRIPT GENERATOR
SH/BASH TCSH/CSH
Begin End Abort

About Me

LA, CA, United States
Here I write about the battles that have been going on in my mind. It's pretty much a scribble.

Sreedhar Manchu

Sreedhar Manchu
Higher Education: Not a simple life anymore