Screen Tips
Saturday, October 4th, 2008A few snippets to make your prompt look better when using screen for linux.
Add the below to your .bashrc so each tab created when you generate a new screen shows user@hostname
function rename_screen_tab () { echo -ne “\x1bk$@\x1b\\”; return 0; }
if [[ "$TERM" = screen* ]]; then
PROMPT_COMMAND=’rename_screen_tab ${USER}@${HOSTNAME%%.*}’
[ "$HOSTNAME" = "hostname-of-mainbox" ] && PROMPT_COMMAND=’rename_screen_tab ${SCREEN_TAB:-$USER}’
fi
Add the below to your .screenrc
hardstatus off
caption always “%?%F%{= Kk}%:%{=u kR}%? %h %-024=%{+b} %C%a %D %d %M %Y%{= db}”
hardstatus alwayslastline
hardstatus string ‘%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]‘
shelltitle “$ |bash”
Note: the hardstatus string should be on the one line.