tmux Cheatsheet - Terminal Multiplexer Command Reference

Essential tmux commands for remote development. Organized by session, window, pane, copy mode, and configuration — keep sessions alive when connections drop.

SysOps·30 commands·Last updated 2026-07-21
Back to SysOps

Session 7

tmux new -s mywork
Create a named session
tmux ls
List all sessions
tmux attach -t mywork
Attach to a specific session
tmux kill-session -t mywork
Kill a specific session
Ctrl+b d
Detach from current session (session keeps running)
Ctrl+b $
Rename current session
tmux kill-server
Kill all sessions and the tmux server

Window 6

Ctrl+b c
Create a new window
Ctrl+b ,
Rename current window
Ctrl+b n / p
Switch to next / previous window
Ctrl+b 0-9
Switch to window by number
Ctrl+b &
Close current window (confirms)
Ctrl+b w
Interactive window list selection

Pane 7

Ctrl+b %
Split pane horizontally
Ctrl+b "
Split pane vertically
Ctrl+b arrow
Move focus between panes
Ctrl+b z
Toggle pane zoom fullscreen/restore
Ctrl+b x
Close current pane (confirms)
Ctrl+b { / }
Swap pane positions
Ctrl+b Space
Cycle through layouts

Copy Mode 5

Ctrl+b [
Enter copy mode, scroll and select text
q
Exit copy mode
Space
Start selection (vi mode)
Enter
Copy selected text
Ctrl+b ]
Paste most recently copied text

Config ~/.tmux.conf 5

set -g mouse on
Enable mouse scrolling and pane dragging
set -g base-index 1
Start window numbering at 1 (default 0)
setw -g mode-keys vi
Use vi key bindings in copy mode
set -g default-terminal "screen-256color"
Enable 256 colors, fix display issues
bind r source-file ~/.tmux.conf \; display "Reloaded!"
Bind r to reload config

💡 Tips

  • tmux sessions survive SSH disconnects — reattach with tmux attach after reconnecting, essential for remote development.
  • Ctrl+b is the default prefix key — change it to Ctrl+a in .tmux.conf if it conflicts with terminal shortcuts.
  • Text selected in copy mode goes to the tmux buffer — extra configuration is needed to sync with the system clipboard.