mac tip, bash alias to lock your screen

I spend most of my time in the terminal, and when I walk away from my laptop I like to lock the screen.Just add this line to the .bash_profile in your home directory.

alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession-suspend'

also make sure you source the file before you run the lock command.Then to lock the screen just run the lock command.

About these ads

One thought on “mac tip, bash alias to lock your screen

  1. Great blog, I already pick 2 or 3 tips from it. Thanks :)At least in Lion you can use Ctrl + Shift + Esc to lock the screen ;)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s