Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer
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
share|improve this answer
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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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