tmux quick reference
Default prefix is Ctrl+b. Replace it below with your configured prefix if different.
sessions
| Action | Keys / Command |
| Start new session | tmux new -s name |
| List sessions | tmux ls |
| Attach | tmux attach -t name |
| Detach | Ctrl+b d |
| Kill session | tmux kill-session -t name |
windows
| Action | Keys |
| New window | Ctrl+b c |
| List windows | Ctrl+b w |
| Next / previous | Ctrl+b n · Ctrl+b p |
| Rename | Ctrl+b , |
| Close window | exit or Ctrl+b & |
panes
| Action | Keys |
| Split vertical / horizontal | Ctrl+b % · Ctrl+b \" |
| Move between panes | Ctrl+b + arrow keys |
| Resize | Ctrl+b then Alt + arrows |
| Rotate panes | Ctrl+b { · Ctrl+b } |
| Close pane | exit or Ctrl+b x |
| Sync panes (toggle) | Ctrl+b :setw synchronize-panes |
copy & paste
| Action | Keys |
| Enter copy mode | Ctrl+b [ |
| Search | / inside copy mode |
| Start selection | Space |
| Copy selection | Enter |
| Paste | Ctrl+b ] |
quality-of-life config
# ~/.tmux.conf
set -g mouse on # scroll and select with mouse
set -g prefix C-a # change prefix to Ctrl+a (optional)
unbind C-b
bind C-a send-prefix
set -g history-limit 20000
bind r source-file ~/.tmux.conf \; display \"config reloaded\"
setw -g mode-keys vi # vi keys in copy mode
set -g status-interval 30 # status refresh
navigation boosters
| Action | Keys |
| Pane numbers overlay | Ctrl+b q |
| Tree view of sessions/windows | Ctrl+b s |
| Choose window | Ctrl+b w |
| Swap panes | Ctrl+b { · Ctrl+b } |
| Zoom pane | Ctrl+b z |
save / restore snippets
# Save 200 lines of scrollback from current pane
tmux capture-pane -S -200 -p > scrollback.txt
# Start a named session if missing, else attach
tmux new -A -s main
auto-attach tmux on ssh
Add to your remote ~/.bashrc (or ~/.bash_profile):
if [ -n \"$SSH_CONNECTION\" ] && [ -z \"$TMUX\" ]; then
tmux new -A -s ssh
exit
fi
Logs you into session ssh automatically when connecting via SSH; skips if already inside tmux.
Return to Home