0

I would like to be able to send a screen command to a screen session "above" my current screen session (which is on another server). Imagine the scenario of starting an initial screen session and from a window inside this session you ssh to another server and start a screen session on that server. Is it possible to send a screen command through current screen session (which is on the remote server) to the first screen session?

  • Sorry, I guess I should have been more clear. I am trying to determine if a screen command could be sent from the inner screen to the outer screen. Something along the lines of (this running on the remote server) screen -X "open window with this command" and this window would open in the outer screen session. – Bob Sep 4 '14 at 18:41
0

I'm not sure what you mean by "Above" your current screen session, but if you have nested screen sessions (screen within screen), you can tell the outer screen to pass the command key along to the inner screen session. By default, the command key to do this is Ctrl+A, which means that you hit Ctrl+A twice to send a command to the inner screen session.

For example:

If I log into server A and start screen, and then SSH from server A into server B and start another copy of screen:

  • Ctrl+A,C will create a new screen window on server A
  • Ctrl+A,Ctrl+A,C will create a new screen window on server B
  • Ctrl+A,Ctrl+A,4 will switch to window #4 on server B
  • Ctrl+A,Ctrl+A,Ctrl+D to detach from the screen session on server B

These assume default keybindings.

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.