Super User is a question and answer site for computer enthusiasts and power users. 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

I have a couple of services running in a GNU-screen session on top of Bash. Because one of the services contain sensitive data I have to constantly either close the terminal completely or lock the screen session using C^a X. Sometimes I forget to close or lock this window when leaving my desk which is not good so I want to know.

How can I get GNU-screen to automatically lock the window after XX minutes of non-use or get Bash/terminal emulator to execute the C^a X command after a time interval? I am aware I can lock the screen using the window manager, but I would like this in addition just in case.


share|improve this question
up vote 3 down vote accepted

See the idle option from screen:

idle [timeout [cmd args]]

Sets a command that is run after the specified number of seconds inac‐ tivity is reached. This command will normally be the "blanker" command to create a screen blanker, but it can be any screen command. If no command is specified, only the timeout is set. A timeout of zero (ot the special timeout off) disables the timer. If no arguments are given, the current settings are displayed.

share|improve this answer
Just to clearify: To get screen to lock itself after for example 4 minutes you would add a line in your ~/.screenrc file containing the following idle 300 lockscreen. – Mogget May 22 '13 at 10:20

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.