Move a program started in GNU screen out to another terminal

TLDR: Practical answer: No.

Longer answer:

In theory you can. If you started something like nohup myprog & from inside the screen then it will continue running. It will ignore a hangup signal and will not have any input, but in theorie you could continue working with it.

In practise this is not the case. Thus unless you want to attach a debugger to the running process and rewrite its file handles and make sure that the process handles -1 signals when you close screen ... then the answer is no.

If you are ready to do this, I have a bookmark at home pointing to [SU] where someone did just that. Saved for awesomeness, not because it is easy and trivial to do.


You can try using reptyr to reattach already running application to different terminal. It has some issues with sending process to background, though.

I just tested it (start htop inside screen, reptyr it to another terminal, kill screen), and it seemed to work alright. Still it's a really hacky solution, so no guarantees.


Yes (if "killing" is not really killing), that's actually exactly what screen is for. You should check the manual and try which one of these fits your needs:

C-a d
C-a C-d     (detach)      Detach screen from this terminal.

C-a D D     (pow_detach)  Detach and logout.

Then what you will need is the -D/-d -R/-r command line options of screen, depending on your choice.