0

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:

taz
  • 141
  • 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 07 '13 at 19:15

1 Answers1

1

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.

michas
  • 21,510
  • 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 04 '13 at 21:59
  • I was not aware of this. Thanks for the hint! - Answer updated. – michas Apr 04 '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 04 '13 at 22:10