tmux

Terminal multiplexer — sessions, windows, panes & copy mode

default prefix Ctrl + b
Core concepts
Sessions
$ tmuxStart new session
$ tmux new -s nameNew named session
$ tmux lsList sessions
$ tmux attachAttach to last session
$ tmux a -t nameAttach to named session
$ tmux kill-session -t nameKill named session
prefixdDetach from session
prefixsList & switch sessions
prefix$Rename current session
prefix( )Previous / next session
Panes (splits)
prefix%Split pane vertically
prefix"Split pane horizontally
prefix← → ↑ ↓Navigate panes
prefixoCycle through panes
prefix;Last active pane
prefixxKill current pane
prefixzToggle zoom (fullscreen)
prefix!Break pane → new window
prefixqShow pane numbers
prefixq 0–9Jump to pane #
Copy mode (vi)
prefix[Enter copy mode
prefix]Paste buffer
prefixPgUpEnter scroll mode
prefix=List paste buffers
SpaceStart selection
EnterCopy selection & exit
q / EscExit copy mode
h j k lMove cursor
w / bForward / back word
g / GTop / bottom of history
/Search forward
?Search backward
n / NNext / prev match
Ctrl+u / dScroll half page up/down
Windows, resizing & config
Windows (tabs)
prefixcCreate new window
prefix,Rename current window
prefixwList & switch windows
prefixnNext window
prefixpPrevious window
prefix0–9Switch to window #
prefix&Kill current window
prefixlLast (previous) window
prefixfFind window by name
prefix.Move window to index #
Pane resizing
prefixCtrl+←Resize left
prefixCtrl+→Resize right
prefixCtrl+↑Resize up
prefixCtrl+↓Resize down
prefixAlt+←Resize left ×5
prefixAlt+→Resize right ×5
prefixAlt+↑Resize up ×5
prefixAlt+↓Resize down ×5
prefixSpaceCycle pane layouts
prefixAlt+1–5Set preset layout #
Command & config
prefix:Open command prompt
prefix?Show all key bindings
prefixtShow clock
:source ~/.tmux.confReload config
:set -g prefix C-aChange prefix key
:set -g mouse onEnable mouse support
:set -g history-limit NSet scrollback size
:setw synchronize-panes onType in all panes
$ tmux new-session -d -s bgDetached background session
$ tmux send-keys -t s "cmd" EnterRun cmd in session
Power tips
Pro tips
Persistent sessions — tmux survives terminal closes. Detach prefix d, reattach tmux a.
🖱️ Mouse support — Add set -g mouse on to ~/.tmux.conf for click-to-focus and drag-to-resize.
🎨 Remap prefix — Many prefer Ctrl+a. Set with set -g prefix C-a + unbind C-b.
📋 Vi copy mode — Add setw -g mode-keys vi for hjkl & search navigation inside copy mode.
🔄 Session managerstmuxinator and tmux-resurrect save & restore full session layouts automatically.
📁 Scripting — Use tmux send-keys, split-window, and select-pane in shell scripts to build repeatable workspaces.