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
prefix›dDetach from session
prefix›sList & switch sessions
prefix›$Rename current session
prefix›( )Previous / next session
Panes (splits)
prefix›%Split pane vertically
prefix›"Split pane horizontally
prefix›← → ↑ ↓Navigate panes
prefix›oCycle through panes
prefix›;Last active pane
prefix›xKill current pane
prefix›zToggle zoom (fullscreen)
prefix›!Break pane → new window
prefix›qShow pane numbers
prefix›q 0–9Jump to pane #
Copy mode (vi)
prefix›[Enter copy mode
prefix›]Paste buffer
prefix›PgUpEnter 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)
prefix›cCreate new window
prefix›,Rename current window
prefix›wList & switch windows
prefix›nNext window
prefix›pPrevious window
prefix›0–9Switch to window #
prefix›&Kill current window
prefix›lLast (previous) window
prefix›fFind window by name
prefix›.Move window to index #
Pane resizing
prefix›Ctrl+←Resize left
prefix›Ctrl+→Resize right
prefix›Ctrl+↑Resize up
prefix›Ctrl+↓Resize down
prefix›Alt+←Resize left ×5
prefix›Alt+→Resize right ×5
prefix›Alt+↑Resize up ×5
prefix›Alt+↓Resize down ×5
prefix›SpaceCycle pane layouts
prefix›Alt+1–5Set preset layout #
Command & config
prefix›:Open command prompt
prefix›?Show all key bindings
prefix›tShow 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 managers — tmuxinator 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.