~/cheatsheets (main) $ tmux list-keys
tmux cheat sheet
tmux keeps terminal sessions running in the background and splits one terminal into windows and panes. Most shortcuts start with the prefix key: press it, release, then press the next key. The default prefix is Ctrl+b; pick yours below and every shortcut updates. Click a command to copy it.
set -g prefix
printtmux sessions
18 lines# Groups of windows that keep running after you disconnect.
Start a new session
Start a new session with a name
List all sessions
Ctrl+b then s
Attach to the last session
Attach to a session by name
Attach and detach every other client
Detach from the session
Ctrl+b then d
Detach other clients from the session
Pick a client to detach
Ctrl+b then D
Rename the current session
Ctrl+b then $
Preview sessions and windows
Ctrl+b then w
Switch to the previous session
Ctrl+b then (
Switch to the next session
Ctrl+b then )
Kill the current session
Kill a session by name
Kill every session except the current one
Kill every session except mysession
Kill the tmux server and every session
tmux windows
14 lines# Full-screen tabs inside a session, numbered from 0.
Start a session with a named window
Create a window
Ctrl+b then c
Rename the current window
Ctrl+b then ,
Close the current window
Ctrl+b then &
Go to the previous window
Ctrl+b then p
Go to the next window
Ctrl+b then n
Go to a window by number
Ctrl+b then 0…9
Toggle the last active window
Ctrl+b then l
Find a window by name or content
Ctrl+b then f
Move the window to another number
Ctrl+b then .
Swap window 2 with window 1
Move the current window one position left
Move a window to another session
Renumber windows to close gaps
tmux panes
19 lines# Splits inside a window. Each pane runs its own shell.
Split into top and bottom
Ctrl+b then "
Split into left and right
Ctrl+b then %
Move to the pane in a direction
Ctrl+b then ←↑↓→
Toggle the last active pane
Ctrl+b then ;
Go to the next pane
Ctrl+b then o
Show pane numbers, then type one to jump
Ctrl+b then q
Zoom or unzoom the current pane
Ctrl+b then z
Swap with the previous pane
Ctrl+b then {
Swap with the next pane
Ctrl+b then }
Rotate the panes in the window
Ctrl+b then Ctrl+o
Cycle through pane layouts
Ctrl+b then Space
Pick a preset layout
Ctrl+b then Alt+1…5
Turn the pane into its own window
Ctrl+b then !
Resize the pane
Ctrl+b then Ctrl+←↑↓→
Close the current pane
Ctrl+b then x
Show a clock in the pane
Ctrl+b then t
Join window 2 into window 1 as a pane
Move pane 2.1 into window 1
Type in every pane at once
tmux copy mode
20 lines# Scroll back, search and copy text. Keys below assume vi mode.
Enter copy mode
Ctrl+b then [
Enter copy mode and scroll up a page
Ctrl+b then PgUp
Quit copy mode
q
Go to the top / bottom
g / G
Move the cursor
h / j / k / l
Jump forward / back one word
w / b
Search forward / backward
/ / ?
Next / previous match
n / N
Start a selection
Space
Clear the selection
Esc
Copy the selection
Enter
Paste the latest buffer
Ctrl+b then ]
Use vi keys in copy mode
Use emacs keys in copy mode
Show the latest buffer
Capture the visible pane into a buffer
List all buffers
Pick a buffer and paste it
Save the buffer to a file
Delete buffer 1
tmux config
7 lines# Run these at the prompt, or put them in ~/.tmux.conf without the colon to keep them.
Change the prefix to Ctrl+a
Turn on mouse support
Number windows and panes from 1
Reload the config with prefix r
Reload the config file now
Set an option for all sessions
Set an option for all windows
tmux help
4 lines# The command prompt, and where to look when you forget.
Open the command prompt
Ctrl+b then :
List all key bindings
Ctrl+b then ?
List every window and pane
Show tmux messages
Ctrl+b then ~