I use a custom hardstatus
line in ~/.screenrc
:
hardstatus alwayslastline "%{wk}%-w%{Gk}[%n %t]%{wk}%+w%=%{Ck}%d %M %Y %c:%s"
combined with a little shell script:
#!/usr/bin/env bash
show_help() {
printf "Usage: con hostname\n"
exit 0
}
[[ "$#" -eq 1 ]] || show_help
uppercase="${1^^}"
lowercase="${1,,}"
screen -t "${uppercase}" -T screen-256color ssh "${lowercase}"
exit 0
Put it somewhere in your PATH, and you only need to call it:
$ my_script hostname
and a new screen session will be allocated with the title set to the hostname you are connecting to.
You can provide further customizations via ~/.ssh/config
settings.