How can I lock the screen via the shell?


  • Solaris 10
  • GNOME desktop environment

For some reason Launch > Lock Screen does not work. A fix for that would also be much appreciated. Thank you.


After reading @egorgry's answer, I tried xlock randomly. I figured xset worked, and lock is what I'm trying to achieve so why not try xlock? It worked!

So for future reference:

The xlock command locks your screen.

  • does this solve the issue with locking from the gui? if you enable it in xset it should work from the gui too. I don't have solaris to play with right now. – egorgry Jul 14 '09 at 18:58

Is the system using the gnome screen saver?

If it is then you can do this:

$ gnome-screensaver-command --lock
  • not a recognized command – George IV Jul 14 '09 at 18:49

use xset -q to see if locking is enabled or disabled. read the xset man to see how to change these settings. I hope this helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.