Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Jan 14 '12 at 18:01

This question came from our site for professional and enthusiast programmers.

up vote 98 down vote accepted

ctrl-a a d

share|improve this answer
If you've customized screen's escape character to something other than Ctrl-A, then the key sequence will be quite different. :) – slacy Mar 16 '09 at 22:28
Yeah, you're on your own with that. <esc> a d may work; the man page is ambiguous, since it says that a sends the escape character, then clarifies that what it means by that is ctrl-A. So it's a crapshoot. – chaos Mar 16 '09 at 22:37
Thanks, there we go, that's exactly what I remembered too and when I told it to my co-worker who was having this problem, he said it didn't work. Of course, now I found out he was pressing ctrl-a, ctrl-a, d, instead of ctrl-a, a, d. Voted and closed. – Artem Russakovskii Mar 16 '09 at 23:32
If you use another escape character just double the second escape key. For example, I use Control+t and so I should press Control+t t d. – brandizzi Feb 2 '12 at 15:34
@brandizzi: Have you tested this? Because I deeply suspect it is not the case, and that the sequence you would use is ctrl-t a d. – chaos Oct 24 '13 at 15:19

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.