tmux/Q/What do I need to know if I'm in tmux when I ssh into a server and use tmux?
What do I need to know if I'm in tmux when I SSH into a server and use tmux?
AI Answer
- Short answer: The outer tmux intercepts your prefix key before it reaches the inner tmux. Press the prefix twice to send it to the inner session. Also watch for
TERMterminfo mismatches on the remote. Prefix key collision
- Both outer (local) and inner (remote) tmux listen on the same prefix (
Ctrl+bby default). - Pressing
Ctrl+b <key>acts on the outer session. - To send a command to the inner session, press the prefix twice:
Ctrl+b Ctrl+b <key>.
- Both outer (local) and inner (remote) tmux listen on the same prefix (
TERMterminfo mismatch- Inside tmux,
TERMis set totmux-256color(orscreen-256color). Remote servers often lack that terminfo entry, causing display artifacts or errors. - Quick fix — set
TERMto a widely available value before SSHing: - Or in
~/.ssh/config: - Permanent fix — install the tmux terminfo on the remote once:
- Inside tmux,
Double status bar
Using a different prefix for the inner session
The
$TMUXenvironment variableSources
- Short answer: The outer tmux intercepts your prefix key before it reaches the inner tmux. Press the prefix twice to send it to the inner session. Also watch for