# GNU Screen within Screen within […]

GNU Screen is great. So great that I find myself always using it. (Pressing the Window key and T launches an XTerm with a new Screen ready on my system, while I have to add Shift if I don’t want the screen.) This means that when I login into a some other machine through SSH—an occasion for which Screen is particularly useful—I will often end up with nested screens. So which Screen will receive my Ctrl+a presses?

The answer (courtesy of Google and Yacin Nadji) is that Ctrl+a will target the outer screen. Each a that you add after that will go down one nesting level.

Not that I don’t still find controlling nested screen confusing, but now at least I don’t feel helpless and stuck whenever it happens. 😉

## Extra tips

1. Visible captions make it easier:

GNU Screen within Screen with captions

(If you don’t know how to configure Screen with captions, I’ve blogged about his previously.)

2. Debian Administration, a very high-quality site has an article about GNU Screen.

1. Comment by Andras Horvath
On December 19, 2009 at 15:22

Thanks for sharing, just what i needed 😉

2. Comment by Alex Swanson
On January 14, 2010 at 19:53

Great info. THanks for the post.

3. Comment by Rogerio Hilbert Lima
On September 7, 2012 at 21:51

Thanks a lot 😀

4. Comment by Jay Straw
On January 22, 2013 at 22:35

Hey man, this wouldn’t work for me, nor did having different escape sequences in the respected screens — the kicker I found in a superuser.com answer by RobM http://superuser.com/questions/232483/how-do-you-run-a-gnu-screen-within-a-gnu-screen

$screen$ screen # frustration
$exit [screen is terminating]$ unset STY
$screen # power and glory The$STY environment variable is set to the “pid.tty” of the first screen, which is carried over into the nested screen. Which means to me, the nested screen is indeed getting my commands — but it’s sending them to the first screen. Because when I clear it, and allow it to be set properly, it works.

This is better than a hot fudge sundae.

5. Comment by Scott
On August 12, 2013 at 21:08

Thanks for the tip ! I just launched a screen session within a screen session, and now having the power to control the inner screen session is super helpful !