Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 searching for the possibility to execute a shell script or command based on idle time in the bash shell.

As an example, if I'm in a SSH session to a server of mine and after X minutes of inactivity in the terminal, I want a command to start a desired program like cmatrix, and when I come back and press a key I will get back where I left.

share|improve this question
You can check the load on cpu using top – totti May 7 '13 at 9:48
Why not run your cmatrix or whatever all the time, but with a nice --adjustment=17 low scheduling priority? See man nice. Then, when you do something interactive, it will have a normal (0) scheduling priority and take over. – waltinator Aug 24 '15 at 3:36

Apparently GNU screen has screensaver capabilities similar to what you're asking, if you put this in your .screenrc:

blankerprg cmatrix -ab -u2
idle 60 blanker
share|improve this answer
Is there no way to get it to run with the -l option too? – Paranoid Panda Nov 18 '15 at 14:59
This only works with a screen session, no? – Thomas W. Nov 18 '15 at 15:25

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.