This question already has an answer here:

Sometimes I'll start doing something fast. I've got something to do, and I need to get it done now.

Then of course i realize that I need to do something else to help me finish what I started, so I want to add a new shell using tmux (or screen)... but I forgot to start tmux right off....

My question is this:

How can I put a task to the background, start a tmux (or screen) session, and then resume my original task in tmux?

marked as duplicate by jasonwryan, manatwork, Hauke Laging, Renan, slm Jun 30 '13 at 20:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Not a duplicate since OP already knows about screen and is stating that he started stuff outside of screen that he wants to import into a new (or second) screen session. – bahamat Jun 30 '13 at 6:53
  • @bahamat That's the same scenario as the question I linked to... – jasonwryan Jun 30 '13 at 7:02

I believe you can do what you want using either reptyr ore retty. With either tool you can start up either screen or tmux and pull processes that have been backgrounded/disowned into either. For example:

$ reptyr <pid>


$ retty <pid>


Not the answer you're looking for? Browse other questions tagged or ask your own question.