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?
- 2,881
2 Answers
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.
- 81,893
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.
- 306