Tmux Cheat Sheet & Quick Reference
Sessions
tmuxtmux newtmux new-sessionnew— start a new sessiontmux new-session -A -s mysession— start or attach to a session namedmysessiontmux new -s mysession— start a new session namedmysession: kill-session— kill/delete the current sessiontmux kill-ses -t mysession/tmux kill-session -t mysession— kill sessionmysessiontmux kill-session -a— kill all sessions but the currenttmux kill-session -a -t mysession— kill all sessions exceptmysessionCtrl + b $— rename sessionCtrl + b d— detach from session: attach -d— detach other clients on the sessiontmux ls/tmux list-sessionsCtrl + b s— show all sessionstmux a/tmux at/tmux attach/tmux attach-session— attach to the last sessiontmux a -t mysession/tmux attach -t mysession— attach tomysessionCtrl + b w— session and window previewCtrl + b (— move to previous sessionCtrl + b )— move to next session
Windows
tmux new -s mysession -n mywindow— start sessionmysessionwith windowmywindowCtrl + b c— create a new windowCtrl + b ,— rename current windowCtrl + b &— close current windowCtrl + b w— list windowsCtrl + b p— go to previous windowCtrl + b n— go to next windowCtrl + b 0…Ctrl + b 9— switch/select window by numberCtrl + b l— toggle last active window: swap-window -s 2 -t 1— reorder windows (swap 2 with 1): swap-window -t -1— move current window left by one: move-window -s src_ses:src_win -t target_ses:target_win— move a window across sessions: movew -s foo:0 -t bar:9/: movew -s 0:0 -t 1:9— reposition window: move-window -r/: movew -r— renumber windows to close gaps
Panes
Ctrl + b ;— toggle last active pane: split-window -hCtrl + b %— split the current pane with vertical line (i.e. vertical split): split-window -vCtrl + b "— split current pane horizontally: join-pane -s 2 -t 1— join two windows as panes: join-pane -s 2.1 -t 1.0— move a pane between windowsCtrl + b {— move current pane leftCtrl + b }— move current pane rightCtrl + b +(or other arrow key combinations) — resize current pane (width/height)Ctrl + b o— switch to next paneCtrl + b q— show pane numbersCtrl + b q+0…9— switch to a pane by numberCtrl + b z— toggle pane zoomCtrl + b !— convert a pane into its own windowCtrl + b Ctrl + …— resize current pane (alternate method)Ctrl + b x— close current pane
Copy Mode
: setw -g mode-keys vi— use vi keys in copy modeCtrl + b [— enter copy modeCtrl + b PgUp— enter copy mode and scroll one page upq— quit copy modeg— go to top lineG— go to bottom lineh/j/k/l— move left, down, up, rightw/b— move forward / backward one word/— search forward?— search backwardn/N— next / previous search occurrenceSpacebar— start selectionEsc— clear selectionEnter— copy selectionCtrl + b ]— paste contents of buffer_0: show-buffer— display buffer_0 contents: capture-pane— copy visible pane contents to buffer: list-buffers— show all buffers: choose-buffer— show buffers and paste selected: save-buffer buf.txt— save buffer to file: delete-buffer -b 1— delete buffer 1
Misc
Ctrl + b :— enter command mode: set -g OPTION— set global option: setw -g OPTION— set window-level option: set mouse on— enable mouse support
Help & Info
tmux list-keys/: list-keys— list all key bindingsCtrl + b ?— show key bindingstmux info— show details about all sessions, windows, panes, etc
This cheat sheet is adapted from tmuxcheatsheet.com.