How to use tmux inside tmux (nested sessions)

Press the prefix twice to send it to the inner tmux:

keysprefix + C-b C-b <key>

The situation

You run tmux locally, SSH somewhere, and attach to tmux there. Now C-b c opens a window in your local session — the outer tmux eats the prefix. C-b C-b c passes it through to the remote one.

Nicer: different prefixes, or an off switch

Set the remote tmux to a different prefix (e.g. C-a) so the two never collide. Or add an F12 "off mode" to your local config that temporarily disables all local keybindings while you work in the inner session — search for "tmux F12 nested" for the full recipe from Sam Oehlert's dotfiles, or start from:

~/.tmux.conf
# on the REMOTE machine's tmux.conf
set -g prefix C-a
unbind C-b
bind C-a send-prefix

"sessions should be nested with care"

That error means you ran tmux new/attach inside tmux on the same machine. You rarely want that — use switch-client (prefix s) to move between local sessions instead. To force real nesting: unset TMUX first (and know why you're doing it).

Related

Verified against tmux 3.6 · updated July 2026 · back to the full cheat sheet