Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

I'm thinking through alerting stuff, and decided that, if my screen is locked, I'm not there so I should push the alerts to my phone. But, I cannot currently tell if the screen is locked. I could put something together with Perl and xscreensaver-command -watch, but I'd rather not have to make sure I have that process always running and all. That seems too heavy.

Is there something I'm missing? This seems fairly obvious.

share|improve this question
up vote 7 down vote accepted


$ xscreensaver-command -time
XScreenSaver 5.15: screen locked since Wed Sep 26 16:26:15 2012
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.