I’ve accidentally attached to a 2nd GNU screen session from within an existing screen session and cannot detach or issue commands to the inner screen. I remember figuring out how to do that before but completely forgot and would like to keep it as reference.
One way is to detach the inner screen by doing screen -dr from shell, but what is the key combination to do that from within screen itself?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
ctrl-a a d
Method 2
ctrl+a a will pass the escape sequence (ctrl+a) to the sub-screen.. So, ctrl+a a d will do ctrl+a d in the sub-screen (detaching it)
It works with any screen command, for example ctrl+a, a, c will create a window in the sub-screen
Method 3
In general, if you have a screen s3 within another screen s2 within another screen s1, you can execute a command ctrl-a d in the screen:
s1by doing: ctrl-a d-
s2by doing: ctrl-a a d -
s3by doing: ctrl-a a a d - …
Method 4
Well, there is a hack for this. Just remotely de-attach the required screen by following command
screen -r -d screen_name or screen -rd screen_name
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0