Prefix Key and Keybindings
The prefix key is the gateway to every tmux command. Building muscle memory for the key bindings is the single most valuable tmux skill.
Every tmux shortcut = prefix + command key. The default prefix is Ctrl+b. You must press and release the prefix before the command key.
How the Prefix Works
Step 1: Press Ctrl+b (press and release)
Step 2: Press d (detach)
This is NOT the same as Ctrl+b+d (all pressed simultaneously). Many beginners make this mistake.
Hold Ctrl+b, release, then press the command key. Do not hold all keys simultaneously.
The Complete Key Binding Reference
Session Management
| Shortcut | Action |
|---|---|
Ctrl+b d | Detach from session |
Ctrl+b s | List / switch sessions (interactive) |
Ctrl+b $ | Rename current session |
Ctrl+b ( | Previous session |
Ctrl+b ) | Next session |
Window Management
| Shortcut | Action |
|---|---|
Ctrl+b c | Create new window |
Ctrl+b , | Rename current window |
Ctrl+b n | Next window |
Ctrl+b p | Previous window |
Ctrl+b l | Last (previously active) window |
Ctrl+b 0-9 | Jump to window by number |
Ctrl+b w | Interactive window list |
Ctrl+b & | Kill current window (with confirm) |
Ctrl+b . | Move window to new index |
Pane Management
| Shortcut | Action |
|---|---|
Ctrl+b % | Split pane vertically |
Ctrl+b " | Split pane horizontally |
Ctrl+b arrow | Navigate panes |
Ctrl+b o | Cycle through panes |
Ctrl+b ; | Last active pane |
Ctrl+b q | Show pane numbers |
Ctrl+b z | Zoom/unzoom current pane |
Ctrl+b ! | Break pane into new window |
Ctrl+b x | Kill current pane (with confirm) |
Ctrl+b { | Move pane left |
Ctrl+b } | Move pane right |
Ctrl+b Space | Cycle through layouts |
Ctrl+b Alt+arrow | Resize pane |
Copy Mode and Scrollback
| Shortcut | Action |
|---|---|
Ctrl+b [ | Enter copy/scroll mode |
Ctrl+b ] | Paste from tmux buffer |
Ctrl+b = | Choose paste buffer |
Ctrl+b # | List paste buffers |
Ctrl+b PgUp | Enter copy mode and scroll up |
Miscellaneous
| Shortcut | Action |
|---|---|
Ctrl+b : | Open command prompt |
Ctrl+b ? | Show all key bindings |
Ctrl+b t | Show clock (press q to exit) |
Ctrl+b ~ | Show messages |
Ctrl+b r | Reload config (if bound in config) |
Changing the Prefix Key
Many users change the prefix to Ctrl+a (like GNU Screen):
# Unbind default prefix
unbind C-b
# Set new prefix
set -g prefix C-a
bind C-a send-prefix
Ctrl+a is easier to type, but conflicts with shell line-start shortcut on many terminals. Consider Ctrl+Space or Ctrl+\ as alternatives.
Creating Custom Key Bindings
# reload config with prefix + r
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
# easy pane splits with | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# vim-style pane navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes with vim-style keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
The -r flag makes the key repeatable — you can press it multiple times without re-pressing the prefix.
Listing Current Key Bindings
# inside tmux
Ctrl+b ?
# from command line
tmux list-keys
Removing a Key Binding
unbind C-b # remove Ctrl+b default prefix
unbind '"' # remove horizontal split default
Key Binding Recommendation for Beginners
Add these to your ~/.tmux.conf to make tmux far more pleasant:
# Easier prefix
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Intuitive splits (remembers current path)
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Vim-style navigation
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Reload config
bind r source-file ~/.tmux.conf \; display "Reloaded!"