"screen -r" attaches to wrong screen if I have screens with similar names
Screen version 4.01.00devel (GNU) 2-May-06, running on Ubuntu Server 14
I make a screen, detach, make another screen with a name matching the first few characters of the other screen's name, and detach. When I try to attach to the first screen again, it attaches me to the second screen instead. The first screen is inaccessible unless I attach to it by PID.
screen -S py_dev
[detached from 11572.py_dev]
screen -S py_dev2
[detached from 29615.py_dev2]
screen -r py_dev
[detached from 29615.py_dev2]
I don't see this behavior in the manual (it simply says screen -r (pid.sessionname)
) or anywhere online. screen -x
has the same problem. If I do screen -r 11572
, I can attach to the first screen, but that's annoying. Any way to avoid this?
Solution 1:
This is a bug: http://savannah.gnu.org/bugs/?43744#comment3
Use the process ID instead, or prefix your numerical session names with zeroes.