🔗TMUX CHEATSHEET (PREFIX: C-b)
🔗SERVER AND CLIENTS
| Command / Binding | Description |
|---|---|
tmux | start new unnamed session |
tmux -L <socket> new | start server with isolated custom socket |
tmux -S /path/to/sock | start server with specific socket path |
tmux kill-server | kill server and all attached sessions |
tmux list-clients | show all connected users/clients |
tmux detach-client -a | detach all clients except the current one |
tmux suspend-client | suspend the current client |
C-b d | detach from current session |
C-b D | choose which client to detach interactively |
🔗SESSION MANAGEMENT
| Command / Binding | Description |
|---|---|
tmux new -s <name> | start new named session |
tmux new -s <name> -d | start session in background (detached) |
tmux new -s <name> -c <dir> | start session with specific working directory |
tmux new -t <target> -s <name> | create grouped session (shared windows) |
tmux a | attach to most recently used session |
tmux a -t <name> | attach to named session |
tmux a -d -t <name> | detach others, then attach to session |
tmux ls | list active sessions |
tmux rename-session -t <old> <new> | rename session from cli |
tmux kill-session -t <name> | kill specific session |
tmux kill-session -a | kill all sessions except current |
C-b s | interactive session tree (switch/kill) |
C-b $ | rename current session |
C-b ( / C-b ) | switch to previous / next session |
C-b L | switch to last used session |
🔗WINDOW MANAGEMENT
| Command / Binding | Description |
|---|---|
C-b c | new window (inherits cwd) |
C-b , | rename current window |
C-b n / C-b p | next / previous window |
C-b 1-9 | go to window by index (base 1) |
C-b w | interactive window list |
C-b & | kill window (prompts) |
C-b . | move window to new index interactively |
C-b f | find window by name |
tmux new-window -n <name> | create named window from cli |
tmux select-window -t <name> | switch to specific window |
tmux move-window -s <src> -t <dst> | move window to new index or session |
tmux swap-window -s <1> -t <2> | swap positions of two windows |
tmux link-window -s <src> -t <dst> | link window so it appears in two sessions |
🔗PANE MOVEMENT AND MANIPULATION
| Command / Binding | Description |
|---|---|
C-b - | split horizontal (pane below, inherits cwd) |
C-b | | split vertical (pane right, inherits cwd) |
C-b h/j/k/l | navigate left/down/up/right |
C-b H/J/K/L | resize left/down/up/right by 5 (repeatable) |
C-b z | toggle zoom (fullscreen pane) |
C-b x | kill current pane (prompts) |
C-b ! | break pane out into its own new window |
C-b { / C-b } | swap pane with previous/next |
C-b Space | cycle through layout presets |
C-b q | show pane indices (press number to jump) |
C-b m / C-b M | mark pane for join/swap operations / clear mark |
C-b S | toggle synchronise-panes (send keys to all) |
tmux split-window -h -p 30 | split vertically, new pane takes 30% width |
tmux split-window -v -l 20 | split horizontally, new pane is 20 lines high |
tmux split-window -f -h | split vertically, span full window height |
tmux join-pane -s <src> -t <dst> | move pane from source window to target window |
tmux swap-pane -s <src> -t <dst> | swap specific panes |
tmux select-layout main-vertical | force specific layout |
🔗COPY MODE AND BUFFERS (VI + WAYLAND)
| Command / Binding | Description |
|---|---|
C-b [ | enter copy mode |
C-b PgUp | enter copy mode and scroll up |
h, j, k, l | navigate cursor |
w, b, e | word forward, back, end of word |
0, $ | start of line, end of line |
g, G | top of buffer, bottom of buffer |
Ctrl-u, Ctrl-d | page up, page down |
/, ? | search forward, search backward |
n, N | next match, previous match |
v | begin character selection |
V | begin line selection |
Ctrl-v | toggle block/rectangle selection |
o | swap cursor to other end of selection |
y | copy to wayland clipboard (wl-copy) & exit |
q / Escape | exit copy mode |
C-b ] | paste from most recent tmux buffer |
C-b = | choose buffer interactively to paste |
C-b - | delete most recent buffer |
C-b # | list all paste buffers |
tmux show-buffer | print most recent buffer to stdout |
tmux save-buffer <file> | write paste buffer to disk |
tmux set-buffer "text" | inject text into tmux buffer |
tmux delete-buffer -b <name> | delete specific buffer |
🔗OPTIONS AND ENVIRONMENT
| Command / Binding | Description |
|---|---|
C-b : | enter command mode |
C-b r | reload ~/.tmux.conf |
C-b ? | list all key bindings |
tmux set -g <option> <value> | set global session option |
tmux set -s <option> <value> | set server option |
tmux set -w <option> <value> | set window option |
tmux set -p <option> <value> | set pane option |
tmux show-options -g | view all global options |
tmux show-environment | view variables passed to tmux |
tmux set-environment <var> <val> | set environment variable for new panes |
🔗PLUGINS (TPM, RESURRECT, CONTINUUM)
| Binding | Description |
|---|---|
C-b I | install plugins listed in config |
C-b U | update all installed plugins |
C-b Alt-u | uninstall plugins removed from config |
C-b Ctrl-s | save session state manually (resurrect) |
C-b Ctrl-r | restore session state manually (resurrect) |
🔗SCRIPTING AND AUTOMATION
| Command | Description |
|---|---|
tmux send-keys -t <target> "cmd" Enter | send arbitrary keystrokes to pane |
tmux capture-pane -p -t <target> | print pane scrollback to stdout |
tmux capture-pane -p -S -100 | print last 100 lines of pane |
tmux pipe-pane -t <target> "cat > log" | stream pane output to file |
tmux display-message -p "#{session_name}" | print formatted variable to stdout |
tmux wait-for -S <channel> | signal a wait channel |
tmux wait-for <channel> | block script until channel signalled |
tmux if-shell "condition" "cmd" | run tmux command conditionally |
tmux set-hook -g after-new-window "cmd" | execute command automatically on event |
🔗TARGET SYNTAX REFERENCE
| Syntax | Target |
|---|---|
-t session | session by name or index |
-t session:window | specific window in session |
-t session:window.pane | specific pane in window |
-t : | current session |
-t :. | current pane |
-t :- / -t :+ | previous / next session |
-t :^ / -t :$ | first / last window |
-t ! | last (previously active) pane |