TMUX Cheatsheet (with Ctrl+A modifier)
| Command | Action |
|---|
tmux new-session -s name | Create new session named "name" |
Ctrl+A :new-session -s name | Create new session from within tmux |
tmux ls | List all sessions |
Ctrl+A s | List sessions (interactive) |
tmux attach -t name | Attach to session "name" |
Ctrl+A d | Detach from current session |
Ctrl+A ( | Switch to previous session |
Ctrl+A ) | Switch to next session |
tmux kill-session -t name | Kill session "name" |
Ctrl+A X | Kill current session |
Ctrl+A $ | Rename current session |
| Command | Action |
|---|
Ctrl+A c | Create new window |
Ctrl+A n | Go to next window |
Ctrl+A p | Go to previous window |
Ctrl+A l | Go to last active window |
Ctrl+A 0-9 | Go to window 0-9 |
Ctrl+A w | List windows (interactive) |
Ctrl+A , | Rename current window |
Ctrl+A & | Kill current window |
Ctrl+A . | Move current window to another position |
Ctrl+A :swap-window -t -1 | Move window left |
Ctrl+A :swap-window -t +1 | Move window right |
Ctrl+A f | Find window by name |
| Command | Action |
|---|
Ctrl+A % | Split pane vertically (left/right) |
Ctrl+A " | Split pane horizontally (top/bottom) |
Ctrl+A o | Go to next pane |
Ctrl+A ; | Go to previously active pane |
Ctrl+A Up/Down/Left/Right | Navigate between panes |
Ctrl+A { | Swap current pane with previous |
Ctrl+A } | Swap current pane with next |
Ctrl+A x | Kill current pane |
Ctrl+A ! | Convert pane to window |
Ctrl+A z | Toggle pane zoom (maximize/restore) |
Ctrl+A Ctrl+o | Rotate panes forward |
Ctrl+A M-o | Rotate panes backward |
Ctrl+A Space | Cycle through pane layouts |
Ctrl+A M-1 to M-5 | Select specific layout |
| Command | Action |
|---|
Ctrl+A Ctrl+Up/Down/Left/Right | Resize pane (1 cell) |
Ctrl+A M-Up/Down/Left/Right | Resize pane (5 cells) |
Ctrl+A :resize-pane -U 10 | Resize pane up 10 cells |
Ctrl+A :resize-pane -D 10 | Resize pane down 10 cells |
Ctrl+A :resize-pane -L 10 | Resize pane left 10 cells |
Ctrl+A :resize-pane -R 10 | Resize pane right 10 cells |
| Command | Action |
|---|
Ctrl+A [ | Enter copy mode |
q or Esc | Exit copy mode |
Space | Start selection |
Enter | Copy selection and exit copy mode |
g | Go to top of buffer |
G | Go to bottom of buffer |
/ | Search forward |
? | Search backward |
n | Next match |
N | Previous match |
w | Forward word |
b | Backward word |
{ | Previous paragraph |
} | Next paragraph |
Ctrl+A ] | Paste from buffer |
Ctrl+A = | List buffers |
Ctrl+A - | Delete last buffer |
| Command | Action |
|---|
Ctrl+A : | Enter command mode |
Ctrl+A ? | List all key bindings |
Ctrl+A t | Display time in current pane |
# Navigation
bind -n C-h select-pane -L
bind -n C-j select-pane -D
bind -n C-k select-pane -U
bind -n C-l select-pane -R
# Splitting panes with intuitive keys
bind v split-window -h
bind s split-window -v
# Reload config
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
# Better window navigation
bind -n M-n next-window
bind -n M-p previous-window
# Mouse support
set -g mouse on
tmux new-session -s dev
Ctrl+A % # Split vertical (left editor, right monitor)
Ctrl+A " # Split bottom pane horizontally
Ctrl+A Left # Select left pane
Ctrl+A c # Create another window for logs
Ctrl+A c # New window
Ctrl+A % # Split vertical
Ctrl+A Left # Navigate to left pane
# Run your app on left, logs/tests on right
tmux new-session -s monitor
Ctrl+A % # Service 1
Ctrl+A % # Service 2
Ctrl+A o # Navigate between services
| Command | Purpose |
|---|
tmux capture-pane -p | Print pane content |
tmux capture-pane -p -S -30 | Print last 30 lines |
tmux send-keys -t session:window "command" Enter | Send command to specific pane |
tmux send-keys -t session "cd /path && ls" Enter | Execute command in session |
- Prefix twice for nested tmux:
Ctrl+A Ctrl+A sends Ctrl+A to nested session - History size: Add
set -g history-limit 50000 to .tmux.conf - Aggressive resize: Add
setw -g aggressive-resize on for better multi-client handling - Status bar:
set -g status-position top to move status bar to top - Auto-rename windows:
setw -g automatic-rename on automatically renames windows based on current command - Monitor activity:
Ctrl+A M marks current window for monitoring - Synchronize panes:
Ctrl+A :setw synchronize-panes run command across all panes simultaneously
# Set prefix to Ctrl+A
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Start window numbers at 1
set -g base-index 1
setw -g pane-base-index 1
# Enable mouse
set -g mouse on
# Set terminal colors
set -g default-terminal "screen-256color"
# Status bar
set -g status-bg black
set -g status-fg white
set -g status-left "[#S]"
set -g status-right "%H:%M %d-%b-%y"
# Key bindings
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind v split-window -h
bind s split-window -v