12

I have to work inside two environment. One Windows (local) and one Linux (remote). I've installed the screen linux utility in both. I'm able to open a screen on my windows, then in one tab, I opened a ssh connection to the linux remote and I start another screen.

Sample

linux  -- |0 linux remote 0| 1 linux remote 1 
windows-- |0 linux | 9 windows 

I can switch between "linux remote 0" and "linux remote 1" using Atl+. This is configured in .screenrc (bindkey "^[0" select 0) How could I switch to "9 windows"?

migrated from stackoverflow.com Aug 25 '11 at 16:26

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

21

Ah. screen-in-screen... very Inception. We need to go deeper...

That being said, you can send a ctrl-A to a nested screen by doing Ctrl-AA.

  • Poetic and precise: what more can a humble developer ask for? ;) – Tomislav Nakic-Alfirevic Nov 17 '14 at 10:53
  • I've found that issuing Ctrl+A A does only toggle between the current and last inner window within the inner screen session. How does one cycle through the entire inner screen window stack? Cheers! – nemesisfixx Mar 22 at 10:29
7

Ctrl+A, 9 or Ctrl+A, " (that's a double-quote) and then select it from a list.

  • 1
    That's how to switch windows in a single screen session. The question is about nested screen sessions. – Keith Thompson Jun 18 '14 at 15:02
4

When I run screen in another screen, I use a different command character for each.

Rather than the default ctrl-A, I use ctrl-space (the null character, escape ^@^@ in .screenrc) for the outer one, and ctrl-] (escape ^]^] in .screenrc) for the inner one.

If you don't do that, you can send a single command character to the inner nested screen session (or to any other command running under screen) by doubling it.

  • This is just what I was looking for - thanks! – andersonbd1 Jun 18 '14 at 13:47
  • How can I change the command character in .screenrc depending on the current depth? – Scz May 28 '15 at 12:22
  • 1
    @Scz: I don't know. I have a screen session running on my home system (with escape ^@^@) and another session running on another system (with escape ^]^]). I just happen to have an ssh to the second system as one of the windows on the first. – Keith Thompson May 28 '15 at 14:47
3

As mentioned by rocka84 but for the second command you don't need to press Ctrl again. Like for creating a new screen in nested terminal you need to do like this Ctrl+a, a, c.

1

You can either press Ctrl+a, followed by Shift+ '(single quote)' and choose the screen you want.

Or you can jus hit Ctrl+a(double tap) to return to previous screen.

1

As mentioned, you can send Ctrl+A to the inner screen with Ctrl+A A. Just do this twice to switch the inner screen.
Make sure to release Ctrl for the second (and forth) A

Btw: This goes for all control sequences of the inner screen, just hit Ctrl+A before all Keys and drop the Ctrl for sequence keys. Easier to show than to describe:
Ctrl+A A C creates a new inner screen.

0

You may use like below

  • for next screen and

Ctrl + A n

for previous screen

Ctrl + A p

0

Marc B's answer seemed to work, except it only juggled between the current and last window in the inner screen session. The following did allow to have the commonly expected behavior of Ctrl+A inside the contained session...

Ctrl+A A

And for example, when cycling through the windows...

Ctrl+A A [N,P]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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