Let's say I have several shell "tabs" (or screens? sessions?) named bash1, bash2, etc. open in GNU screen. I want the status bar (i.e., the caption line) to display the names as "bash1 | bash2 | ..", with the currently open tab and the last open tab clearly marked.

How do I make this happen with my .screenrc?

  • I don't see anything in the screen manpage (at least for 4.00.02) that enumerates the previous window. Current window sure (%t)
    – Ricky
    Commented Feb 10, 2014 at 7:07

2 Answers 2


Edit or create (if not present) /etc/screenrc or (~/.screenrc) and add below code

autodetach on 
startup_message off 
hardstatus alwayslastline 
shelltitle 'bash'

hardstatus string '%{gk}[%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}][%{d}%l%{g}][ %{= w}%Y/%m/%d %0C:%s%a%{g} ]%{W}'

shelltitle 'bash' can be changed once the screen is created. (Ctrla + A) session name can be changed to SESSSIONNAME with :sessionname SESSIONNAME.

  • Yup, that does it. Need to customize it a little though - I don't want to see time, etc. Will figure that out later. Thanks!
    – ARV
    Commented Feb 10, 2014 at 8:37
  • @ARV , yeah it can be customized by user.
    – GC 13
    Commented Feb 13, 2014 at 9:29
  • 1
    This, without time etc: '%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}]' Commented Jun 1, 2017 at 11:30

The "tab" you are referring is Window (correct me if I'm wrong). You should try Byobu, which is a wrapper around screen and tmux.

I'm sure it comes with caption line, highlighting current window by default, but I don't remember there's ability to mark the last open window.

BUT seriously you should try tmux.

You must log in to answer this question.

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