Search code examples
linuxunixtmux

Recover infinitely nested/recursed tmux session?


I'm starting to use nested tmux sessions and I accidentally nested the same session twice. In other words:

tmux new -s mysession

# and then later in a mysession window:
TMUX= tmux attach -t mysession

Now tmux is borked, printing endless '.'s on the screen. It won't run any commands, including tmux commands (except detaching) and is basically unresponsive. Is there a way I can kill the problematic window from outside of tmux without killing my tmux session?


Solution

  • From outside of tmux, run:

    tmux attach -dt mysession
    

    Adding the -d will automatically force all other connections to detach from your session before attaching, including the connection coming from within the session itself.