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

Is it possible to get GNU Screen to display the output of an arbitrary command, e.g. who | wc -l, in the status bar, refreshing it, say, every minute?

share|improve this question
up vote 4 down vote accepted

Yes you can using the backtick feature. Backtick

You put a line in your screenrc file:

backtick 1 0 5 /bin/date

If I understand correctly, it means backtick id 1, which runs command /bin/date, produces output valid for 0 seconds and the caption/hardstatus should be updated every 5 seconds.

Now, you can use the string %1` inside your hardstatus for substitution, eg

hardstatus alwayslastline "date output: %1`"

In your case, I think you'll have to write a script. For example, $HOME/

who | wc -l

In your ~/.screenrc:

backtick 1 0 60 $HOME/
hardstatus alwayslastline "who|wc -l output: %1`"

Obviously you won't want exactly that, but just add %1` to whatever else you have. Note that your script output can't include string escapes for screen to expand, e.g. if your script is echo "%{bg}blue on green%{dd}" it won't be coloured, you'll just see ${bg} and ${dd} in your status line.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .