Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

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?

share|improve this question

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
up vote 3 down vote accepted

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>

-or-

$ retty <pid>

References

share|improve this answer

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