Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
You can also do the same thing by pressing the following on a Mac with an Eject button on the keyboard:-

[Shift] + [Control] + [Eject]

Apparently (I've not tried this) the following works on the newer Macs where the eject button is replaced by the power button (top right of the keyboard):-

[Shift] + [Control] + [Fn] + [Power Button]
 
You can also do the same thing by pressing the following on a Mac with an Eject button on the keyboard:-

[Shift] + [Control] + [Eject]

Apparently (I've not tried this) the following works on the newer Macs where the eject button is replaced by the power button (top right of the keyboard):-

[Shift] + [Control] + [Fn] + [Power Button]

The two commands that you show do put the display to sleep, but don't however lock it, as this tutorial shows.
 
The two commands that you show do put the display to sleep, but don't however lock it, as this tutorial shows.

thats dependant on your settings.
Make sure you have the require password after sleep option ticked in the security & privacy section of the system preferences.
That when when you use the shortcut to send the mac to sleep it will ask you for your password when you start using it again.
 
Interesting. My preference is a hot corner to start the screen saver and lock the screen. Just throw the mouse down & to the right. :)
 
Those keyboard shortcuts can't be remapped using the built in shortcut remapper in the system preferences panel and I wanted a shortcut that I could execute with one hand since I usually hit the key combo when I'm standing up from my desk to walk out.

So, I downloaded a set of little scripts (apps) called Dockables and then I used an app called Alfred to create a keyboard shortcut that executes the Dockables app that sleeps the screen.

I've got the "require password immediately" option selected so as soon as the screen sleeps, it requires a password to get back in. A little bit of a lengthy process to accomplish the goal but there was no quick solution I could find that provided all the bits I wanted.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.