Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Because of some server issues I ended up with two screen sessions, each with a few windows. I have long-running tasks in both sessions and don’t want to abort one of them just to get rid of one of the screen sessions.

Is it possible to concatenate screen sessions so that I end up with a single screen session that contains all windows from both sessions? Or is is possible to manually transfer individual windows from one screen session to another one?

share|improve this question
add comment

2 Answers

As far as I am aware, this is not possible using screen, but you could use reptyr to reassign the program to a new terminal.

Here is some useful guidance on using reptyr:

You could also look at using the slightly less complex grab.c.

share|improve this answer
    
There are several alternatives to reptyr, sometimes one will work where another will fail. For alternatives, see How can I disown it a running process and associate it to a new screen shell? and linked questions. –  Gilles Sep 27 '11 at 0:04
add comment

As already answered, there isn't a way with screen alone.

You can also rebind one session's escape character, and therefore have full functionality again (without the need to open another ssh session to your server and detaching one of your sessions - kind of cryptic, I know).

Hit Ctrl-A : which will put you into command mode (if you haven't changed the defaults) and put the following: escape ^Tt. This will change the escape character of one session setting it to Ctrl-T and leaving the other session with Ctrl-A escape char, thus, being able to send commands again to both sessions.

share|improve this answer
2  
No need to rebind: "C-a a (meta) Send the command character (C-a) to window. See escape command.". So in the "sub-screen" use C-a a, instead of bare C-a. I use it every day. –  enzotib Sep 27 '11 at 3:36
    
@enzotib: That is not what I meant. You are talking about readline bindings (Ctrl-a goes to the beginning of the line) and I about screen escape character. If you have two sessions, one inside the other, and both sessions have the same screen-escape-character, who grabs it (i.e. Ctrl-a C for creating another window), the inner most or the outer most ? That is why, when you want to run a screen inside a screen, you have to change one's screen-escape-character. –  Torian Sep 27 '11 at 3:55
1  
it is exactly what I mean: C-a + c create a window in the outer screen, and C-a + a + c create a window in the inner screen. So to send a C-a + Something to the inner screen you can do C-a + a + Something –  enzotib Sep 27 '11 at 6:41
    
hu, that's nice, didn't know about it :). Either way I prefer rebinding the escape command, it's clearer to me. –  Torian Sep 27 '11 at 10:46
add comment

Your Answer

 
discard

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.