Home
Tmux command cheat sheet
tmux Sessions
- Start a new session:
tmux or tmux new or tmux new-session
- Start a new session with a specific name:
tmux new -s [session_name]
- Attach to the last active session:
tmux attach or tmux a
- Attach to a session with a specific name:
tmux attach -t [session_name] or tmux at [session_name]
- Disconnect from a session, but keep it running:
tmux detach or CTRL+b then d
- List all active sessions:
tmux list-sessions or tmux ls or CTRL+b then s
- Switch to a different session:
tmux switch -t [session_name]
- Move to the previous session:
CTRL+b then (
- Move to the next session:
CTRL+b then )
- Rename an existing session:
tmux rename-session -t [old_name] [new_name] or CTRL+b then $
- Terminate all sessions but the current one:
tmux kill-session -a
- Terminate a specific session:
tmux kill-session -t [session_name]
tmux Windows
- Create a new window:
tmux new-window or CTRL+b then c
- Create a new window with a specific name:
tmux new-window -n [window_name]
- Switch to the previous window:
tmux previous-window or CTRL+b then p
- Switch to the next window:
tmux next-window or CTRL+b then n
- Go to a specific window number:
CTRL+b then [number]
- Rename the current window:
tmux rename-window [new_name] or CTRL+b then ,
- Kill the current window:
tmux kill-window or CTRL+b then &
- List all windows:
tmux list-windows or CTRL+b then w
- Link a window to another session:
tmux link-window -s [source_session]:[source_window] -t [target_session]
- Unlink a window:
tmux unlink-window -t [session]:[window]
tmux Panes
- Split the pane horizontally:
tmux split-window -h or CTRL+b then "
- Split the pane vertically:
tmux split-window -v or CTRL+b then %
- Navigate between panes:
tmux select-pane -t [pane_number] or CTRL+b then [arrow key]
- Navigate to the next pane:
CTRL+b then o
- Kill the current pane:
tmux kill-pane or CTRL+b then x
- Swap current pane with the previous one:
CTRL+b then {
- Swap current pane with the next one:
CTRL+b then }
- Zoom in on the current pane:
tmux resize-pane -Z or CTRL+b then z
- Show pane numbers:
CTRL+b then q
Pane Resizing
- Resize pane left (1 cell):
CTRL+b then CTRL+Left
- Resize pane right (1 cell):
CTRL+b then CTRL+Right
- Resize pane up (1 cell):
CTRL+b then CTRL+Up
- Resize pane down (1 cell):
CTRL+b then CTRL+Down
- Resize pane left (5 cells):
CTRL+b then ALT+Left
- Resize pane right (5 cells):
CTRL+b then ALT+Right
- Resize pane up (5 cells):
CTRL+b then ALT+Up
- Resize pane down (5 cells):
CTRL+b then ALT+Down
tmux Copy Mode
- Enter copy mode:
tmux copy-mode or CTRL+b then [
- Quit copy mode:
q
- Start selection:
Spacebar
- Clear selection:
Esc
- Copy selection:
Enter
- Paste contents of buffer_0:
CTRL+b then ]
- Move the cursor left:
h
- Move the cursor down:
j
- Move the cursor up:
k
- Move the cursor right:
l
- Move the cursor forward one word at a time:
W
- Move the cursor backward one word at a time:
b
- Go to top line:
g
- Go to bottom line:
G
- Search forward:
/
- Search backward:
?
- Previous keyword occurrence:
N
- Next keyword occurrence:
n
- Use vi keys in buffer:
setw -g mode-keys vi
- Show all buffers:
list-buffers
- Copy entire visible contents of pane to a buffer:
capture-pane
- Show all buffers and paste selected:
choose-buffer
tmux Miscellaneous
- Detach and keep the session running:
tmux detach or CTRL+b then d
- Show a list of all key bindings:
CTRL+b then ?
- Command mode:
CTRL+b then :
- Reload configuration file:
tmux source-file ~/.tmux.conf or CTRL+b then r
- Disconnect all other clients:
tmux detach-client -a
- Force tmux to assume 256 colors:
tmux -2
- Send the prefix key to the current pane:
CTRL+b then b
- List all commands:
list-commands
Step-by-Step Examples
Example 1: Basic Multi-Pane Development Setup
- Start new session:
tmux new -s dev
- Split horizontally for code editor:
CTRL+b then "
- Move to bottom pane:
CTRL+b then Down Arrow
- Split vertically for terminal and logs:
CTRL+b then %
- Navigate between panes:
CTRL+b then arrow keys
- Zoom into editor pane:
CTRL+b then Up Arrow → CTRL+b then z
Example 2: Resizing Panes for Better Layout
- Create horizontal split:
CTRL+b then "
- Top pane too small? Make it bigger:
CTRL+b then CTRL+Down (repeat as needed)
- Bottom pane now too big? Make it smaller:
CTRL+b then CTRL+Up
- For faster resizing:
CTRL+b then ALT+Down (resizes by 5 cells)
Example 3: Managing Multiple Projects
- Create first project session:
tmux new -s project1
- Work on project1, then detach:
CTRL+b then d
- Create second project session:
tmux new -s project2
- Switch between projects:
tmux attach -t project1 or CTRL+b then s
- List all sessions:
tmux ls
Example 4: Copy Mode Workflow
- Enter copy mode:
CTRL+b then [
- Navigate to text you want: arrow keys or
h/j/k/l
- Start selection:
Spacebar
- Extend selection: arrow keys
- Copy selection:
Enter
- Move to different pane:
CTRL+b then arrow key
- Paste:
CTRL+b then ]
Example 5: Window and Pane Navigation
- Create new window:
CTRL+b then c
- Split into panes:
CTRL+b then " → CTRL+b then %
- Show pane numbers:
CTRL+b then q → press 2 to jump to pane 2
- Switch windows:
CTRL+b then 1 (for window 1)
- Go back to previous window:
CTRL+b then p
Example 6: Advanced Pane Management
- Create 4-pane layout:
- Start:
CTRL+b then "
- Top pane:
CTRL+b then %
- Bottom pane:
CTRL+b then Down Arrow → CTRL+b then %
- Resize panes for code/terminal/logs/monitoring:
- Make code pane (top-left) larger:
CTRL+b then CTRL+Right (repeat)
- Make logs pane (bottom-right) taller:
CTRL+b then CTRL+Up
- Swap panes if needed:
CTRL+b then { or }# Tmux Command Cheat Sheet
tmux Sessions
- Start a new session:
tmux or tmux new or tmux new-session
- Start a new session with a specific name:
tmux new -s [session_name]
- Attach to the last active session:
tmux attach or tmux a
- Attach to a session with a specific name:
tmux attach -t [session_name] or tmux at [session_name]
- Disconnect from a session, but keep it running:
tmux detach or CTRL+b then d
- List all active sessions:
tmux list-sessions or tmux ls or CTRL+b then s
- Switch to a different session:
tmux switch -t [session_name]
- Move to the previous session:
CTRL+b then (
- Move to the next session:
CTRL+b then )
- Rename an existing session:
tmux rename-session -t [old_name] [new_name] or CTRL+b then $
- Terminate all sessions but the current one:
tmux kill-session -a
- Terminate a specific session:
tmux kill-session -t [session_name]
tmux Windows
- Create a new window:
tmux new-window or CTRL+b then c
- Create a new window with a specific name:
tmux new-window -n [window_name]
- Switch to the previous window:
tmux previous-window or CTRL+b then p
- Switch to the next window:
tmux next-window or CTRL+b then n
- Go to a specific window number:
CTRL+b then [number]
- Rename the current window:
tmux rename-window [new_name] or CTRL+b then ,
- Kill the current window:
tmux kill-window or CTRL+b then &
- List all windows:
tmux list-windows or CTRL+b then w
- Link a window to another session:
tmux link-window -s [source_session]:[source_window] -t [target_session]
- Unlink a window:
tmux unlink-window -t [session]:[window]
tmux Panes
- Split the pane horizontally:
tmux split-window -h or CTRL+b then "
- Split the pane vertically:
tmux split-window -v or CTRL+b then %
- Navigate between panes:
tmux select-pane -t [pane_number] or CTRL+b then [arrow key]
- Navigate to the next pane:
CTRL+b then o
- Kill the current pane:
tmux kill-pane or CTRL+b then x
- Swap current pane with the previous one:
CTRL+b then {
- Swap current pane with the next one:
CTRL+b then }
- Zoom in on the current pane:
tmux resize-pane -Z or CTRL+b then z
- Show pane numbers:
CTRL+b then q
Pane Resizing
- Resize pane left (1 cell):
CTRL+b then CTRL+Left
- Resize pane right (1 cell):
CTRL+b then CTRL+Right
- Resize pane up (1 cell):
CTRL+b then CTRL+Up
- Resize pane down (1 cell):
CTRL+b then CTRL+Down
- Resize pane left (5 cells):
CTRL+b then ALT+Left
- Resize pane right (5 cells):
CTRL+b then ALT+Right
- Resize pane up (5 cells):
CTRL+b then ALT+Up
- Resize pane down (5 cells):
CTRL+b then ALT+Down
tmux Copy Mode
- Enter copy mode:
tmux copy-mode or CTRL+b then [
- Quit copy mode:
q
- Start selection:
Spacebar
- Clear selection:
Esc
- Copy selection:
Enter
- Paste contents of buffer_0:
CTRL+b then ]
- Move the cursor left:
h
- Move the cursor down:
j
- Move the cursor up:
k
- Move the cursor right:
l
- Move the cursor forward one word at a time:
W
- Move the cursor backward one word at a time:
b
- Go to top line:
g
- Go to bottom line:
G
- Search forward:
/
- Search backward:
?
- Previous keyword occurrence:
N
- Next keyword occurrence:
n
- Use vi keys in buffer:
setw -g mode-keys vi
- Show all buffers:
list-buffers
- Copy entire visible contents of pane to a buffer:
capture-pane
- Show all buffers and paste selected:
choose-buffer
tmux Miscellaneous
- Detach and keep the session running:
tmux detach or CTRL+b then d
- Show a list of all key bindings:
CTRL+b then ?
- Command mode:
CTRL+b then :
- Reload configuration file:
tmux source-file ~/.tmux.conf or CTRL+b then r
- Disconnect all other clients:
tmux detach-client -a
- Force tmux to assume 256 colors:
tmux -2
- Send the prefix key to the current pane:
CTRL+b then b
- List all commands:
list-commands
Step-by-Step Examples
Example 1: Basic Multi-Pane Development Setup
- Start new session:
tmux new -s dev
- Split horizontally for code editor:
CTRL+b then "
- Move to bottom pane:
CTRL+b then Down Arrow
- Split vertically for terminal and logs:
CTRL+b then %
- Navigate between panes:
CTRL+b then arrow keys
- Zoom into editor pane:
CTRL+b then Up Arrow → CTRL+b then z
Example 2: Resizing Panes for Better Layout
- Create horizontal split:
CTRL+b then "
- Top pane too small? Make it bigger:
CTRL+b then CTRL+Down (repeat as needed)
- Bottom pane now too big? Make it smaller:
CTRL+b then CTRL+Up
- For faster resizing:
CTRL+b then ALT+Down (resizes by 5 cells)
Example 3: Managing Multiple Projects
- Create first project session:
tmux new -s project1
- Work on project1, then detach:
CTRL+b then d
- Create second project session:
tmux new -s project2
- Switch between projects:
tmux attach -t project1 or CTRL+b then s
- List all sessions:
tmux ls
Example 4: Copy Mode Workflow
- Enter copy mode:
CTRL+b then [
- Navigate to text you want: arrow keys or
h/j/k/l
- Start selection:
Spacebar
- Extend selection: arrow keys
- Copy selection:
Enter
- Move to different pane:
CTRL+b then arrow key
- Paste:
CTRL+b then ]
Example 5: Window and Pane Navigation
- Create new window:
CTRL+b then c
- Split into panes:
CTRL+b then " → CTRL+b then %
- Show pane numbers:
CTRL+b then q → press 2 to jump to pane 2
- Switch windows:
CTRL+b then 1 (for window 1)
- Go back to previous window:
CTRL+b then p
Example 6: Advanced Pane Management
- Create 4-pane layout:
- Start:
CTRL+b then "
- Top pane:
CTRL+b then %
- Bottom pane:
CTRL+b then Down Arrow → CTRL+b then %
- Resize panes for code/terminal/logs/monitoring:
- Make code pane (top-left) larger:
CTRL+b then CTRL+Right (repeat)
- Make logs pane (bottom-right) taller:
CTRL+b then CTRL+Up
- Swap panes if needed:
CTRL+b then { or }