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:

Is it possible (and if so, how?) to move a process from a terminal emulator running in X to a different virtual terminal, so that I can restart the X server without killing the process running in the terminal emulator?

Similar questions:

share|improve this question

marked as duplicate by Gilles, jasonwryan, vonbrand, uther, n0pe Apr 5 '13 at 3:12

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.

I've never seen any way of doing so. It would mean to redirect the stdin, stdout and stderr files, and assorted other state. Too hard, very little reason to do it. – vonbrand Apr 7 '13 at 19:15

Use screen. This will allow you to detach your whole session and attach it again from some other terminal.

If you start it without screen your output is bound directly to that terminal. In this case you can use a tool like reptyr to transfer your process to another terminal. (Probably into a screen session. ;) )

Alternatives to screen are tmux and dtach.

Alternative to reptyr is retty.

Furthermore neercs seems to allow both.

share|improve this answer
You can attach an already running process to another terminal using reptyr. @taz, search for reptyr here to find a lot of similar questions. – Stéphane Chazelas Apr 4 '13 at 21:59
I was not aware of this. Thanks for the hint! - Answer updated. – michas Apr 4 '13 at 22:05
I believe that screen and tmux are not options in this specific scenario because AFAIK I definitely need to change the process owner and controlling terminal of the process to be moved, so that it doesn't get killed when the X server shuts down. Also, I need this for a process that is already running in an X server that was not started using screen or any similar tools. At a glance, it looks like reptyr is exactly what I'm looking for. – taz Apr 4 '13 at 22:10

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