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 use GNU screen to keep a bunch of tabs open in my terminal session, and I would like to have a bash command, watch -n 1 ps aux | grep something, that runs when I am looking at that screen tab, but stops running when I don't have any window displaying at the tab. Any ideas?

share|improve this question

no can do. this cannot be automized. sorry.

workaround: use a command alias to start such a tab/window, eg "bind S screen ~/bin/myscript". put screen into zombie mode (eg with ":zombie z"). end the script when not required any more. switch to tab and restart process with ctrl-space.

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.