3 ms·
My favorite utility is a shell function for quickly attaching to an existing screen session after connecting via ssh (or creating a new one if none exists). It'
by olifante 4y ago
My favorite utility is a shell function for quickly attaching to an existing screen session after connecting via ssh (or creating a new one if none exists). It's pretty handy for treating a single ssh connection to a server as if it was a long-lived multi-tab terminal:
sshcreen () {
ssh -t "$@" screen -xRR
}
Works with bash and zsh. Usage is pretty simple:
$ sshcreen user@example.com
Or for local Docker instances mapped to port 2222:
$ sshcreen root@localhost -p 2222
Detach the session with CTRL-A + D, reattach by rerunning the sshcreen command you previously used.