Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to move windows between different screen sessions?

For example lets say I have this scenario:

screen -S screen1
vim *.cpp
C-a d
screen -S screen2

Is there any way to move my shell containing my vim session from screen1 to screen2?

share|improve this question
i don't think so, but i'm not much of a screen guru. interesting question, +1. – quack quixote Apr 10 '10 at 5:54
found a discussion on the screen mailing list - - it's not possible at the moment and a 'nightmare' to implement apparently. – William Casarin Apr 12 '10 at 16:40
up vote 3 down vote accepted

You can use injcode to move a process between ttys. To move process with PID run in target screen window:

$ injcode -m retty PID

However when you close the parent Screen session, moved processes will also terminate.

Edit: I was wrong, it works. Everything is described here. Suppose you want to move "htop" and only one instance is running:

$ injcode -m retty $(pgrep htop)
$ pkill -SIGSTOP htop
$ pkill -SIGCONT htop

then on the previous shell type:

$ disown
share|improve this answer
Sort of hacky but it worked! Awesome. – William Casarin Aug 26 '10 at 2:41

Your Answer


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.