tmux is my daily driver for local terminal multiplexing, I still use GNU
screen when I’m working on remote servers. The primary reason for this is to
tmux sessions. I can use
ssh to a remote
server, start up a
screen session and I’m off to the races.
Where things came to a grinding halt recently, was when I was disconnected from
a remote server. No big deal,
ssh back out and use
screen -r to reattach to
the now disconnected session.
No dice. The
screen session was still showing as attached for some reason, and
it couldn’t be resumed. Passing in the
screen session’s ID didn’t help
screen session attached, the only logic way to go about it would be
to detach the session. To do so, I found the ID of the session with the
% screen -ls There is a screen on: 22381.pts-6.server (Attached)
To detach the still attached session and then reattach, simply run:
% screen -D 22381 [22381.pts-6.server power detached.] % screen -r
Or you can streamline things by chaining the two arguments together:
% screen -Dr 22381
Which will attempt to reattach, detaching any attaching sessions if need be.