There may be cases when you don't want to click some buttons to lock your screen .
Then there is command for you to do so and it is fairly simple..
gnome-screensaver-command -l
Then there is command for you to do so and it is fairly simple..
gnome-screensaver-command -l
-l will activate your lock screen ,
-t will activate your screen saver after the time you specify