How to move a running process into tmux
Steal a running process into the current pane (Linux):
reptyr
reptyr reattaches a process to your current terminal. Suspend the process's control (Ctrl-Z; bg; disown in its original shell), then in tmux run reptyr PID. On many distros you'll need sudo sysctl kernel.yama.ptrace_scope=0 first. macOS: no reliable equivalent — dtrace-based tricks exist but are fragile.
The honest answer
This is a rescue maneuver, not a workflow. If a job might outlive your terminal, start it in tmux (or at least with nohup/setsid). tmux new -As main as a login habit makes "oops, wrong terminal" impossible.
Related
Verified against tmux 3.6 · updated July 2026 · back to the full cheat sheet