0

My IRC client, irssi, is currently active inside a GNU screen session.
In hindsight, I wish that I'd have used tmux instead of GNU screen.
How can I migrate the active process (or session) from GNU screen to tmux?

voices
  • 2,651
  • 8
  • 29
  • 47
  • Adding as a comment since this migrates to `tmux`, but doesn't actually migrate from `screen` as asked. [1] * Press Ctrl-A, then d (detach `screen`) [2] Run `tmux` [3] Run: `screen -R -x` [4] Enjoy `tmux`. Don't press Ctrl-A. Ignore `screen`. – TOOGAM Mar 08 '16 at 15:59

2 Answers2

1

Use reptyr.

This other answer of mine provides useful details. It is about migrating an outside process into screen/tmux, but I have just tested on my Debian 9 and successfully migrated htop from screen to tmux.

After finding the PID of htop, I invoked reptyr PID from a shell inside tmux. I then went back to screen and terminated it totally; this included exiting the shell that had started htop. htop did survive attached to a tty provided by tmux. I believe your irssi will survive as well.

exec reptyr PID or tmux new-window 'reptyr PID' would also work, although there would be no shell between the tmux server and reptyr. In case of a simple reptyr PID invoked in an interactive shell, the shell keeps running and you will get back to it after the captured process terminates eventually.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
0

Migrating an active session from screen to tmux is unfortunately not possible today as the functionality to do so has not been developed. They are completely different applications and don't support managing each other's sessions - that may change in future, but it's not possible as of April 2016.

What I'd suggest as a workaround is attaching to your existing irssi screen session within a tmux window. In other words, do a screen -r from within one of your tmux windows. You may have some conflicts if their keybindings clash (for example if you've remapped your tmux hotkey to be Ctrl-A, the screen default), but you can at least just use one application and not two.

mjturner
  • 306
  • 2
  • 6
  • 1
    Not possible, or not supported? What technical limitation prevents the possibility of making the required changes in RAM? – TOOGAM Mar 08 '16 at 15:56
  • Well, yes you're right. There's nothing making it impossible - `tmux` and/or `screen` could add support for managing the other's sessions. I'll amend my answer to make it a bit clear - it's not possible *today* as the support isn't there. But that may, of course, change at some point... – mjturner Mar 30 '16 at 18:46
  • Your attempt at making "not possible" more clear has been successful, yet the current phrasing still feels wrong. You may want to look up the definition of "possible", and contrast that to some other words or phrases, such as "supported option", "a convenient process/procedure", "currently implemented feature", "available usable functionality", etc. These are open source programs, and statements like "not possible" may dissuade novice coders from even considering the task of adding such functionality. – TOOGAM Mar 30 '16 at 20:48
  • 1
    *shrug* I think "possible today" makes it fairly clear. Feel free to rewrite my answer if you're still unhappy... – mjturner Mar 30 '16 at 21:03