Quick switching between screen sessions

gnu-screen

Suppose that I have two screen sessions (screen_session_a and screen_session_b), both of which have several windows (window_1 to window_n).

The hierarchical layout looks like this:

+--+ screen_session_a
|  +- window_0
|  +- window_1
|  +- ..
|  +- window_n
|
+--+ screen_session_b
   +- window_0
   +- window_1
   +- ..
   +- window_n

I'm aware that switching between windows within the same session can be done efficiently with <CTRL> A-n, <CTRL> A-p, and so on. But now let's say I want to switch windows from different screen sessions, e.g. from screen_session_b/window_1 to screen_session_a/window_1.

At the moment I would do the following:

  • Detach from screen_session_b by hitting <CTRL> A-d
  • Attach screen_session_a with screen -r screen_session_a
  • If window_1 is not open yet, switch the window: <CTRL> A-' 1 <CR>

This is pretty cumbersome, especially if you need to to that very often. So I wondered if there is a more efficient way to switch between windows across different screen sessions?

Best Answer

this is not possible with screen and there is no way to easily work around this limitation of screen. Screen sessions are independent and has no knowledge of other screen session running.

If you need this you can switch to tmux which does have this feature to awitch between sessions.

Related Question