Ubuntu – GNU screen status bar – how to make it display shell session names

gnu-screenUbuntu

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?

Best Answer

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.