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.