Skip to main content

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.

Core Idea

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.

warning

Hold Ctrl+b, release, then press the command key. Do not hold all keys simultaneously.

This Server's Custom Prefix

This server uses Ctrl+Space as prefix (instead of Ctrl+b). All default prefix bindings still work — just replace Ctrl+b with Ctrl+Space. The tables below show both columns side by side.

Additionally, these prefix-free shortcuts are available (no prefix key needed):

DefaultPrefix-Free AlternativeAction
Ctrl+b arrowsAlt+arrowsNavigate panes
Ctrl+b arrowsAlt+h/j/k/lNavigate panes (vim-style)
Ctrl+b zAlt+zToggle zoom
Ctrl+b n/pAlt+PageDown/UpNext/previous window
Ctrl+b 1/2/3Alt+1/2/3Jump to window 1/2/3
Ctrl+b (/ )Alt+Home/EndPrevious/next session

The Complete Key Binding Reference

Session Management

Default ShortcutModification ShortcutAction
Ctrl+b dCtrl+Space dDetach from session
Ctrl+b sCtrl+Space sList / switch sessions (interactive overview)
Ctrl+b $Prefix e sRename current session
Ctrl+b (Alt+HomePrevious session
Ctrl+b )Alt+EndNext session

Window Management

Default ShortcutModification ShortcutAction
Ctrl+b cCtrl+Space WCreate new window
Ctrl+b ,Prefix e wRename current window
Ctrl+b nAlt+PageDownNext window
Ctrl+b pAlt+PageUpPrevious window
Ctrl+b lCtrl+Space lLast (previously active) window
Ctrl+b 0-9Alt+1/2/3 or Ctrl+Space 0-9Jump to window by number
Ctrl+b wCtrl+Space wSearchable session/window/pane tree
Ctrl+b &Ctrl+Space XKill current window (with confirm)
Ctrl+b .Ctrl+Space .Move window to new index
Fast Navigator

Use Ctrl+b w as the primary navigator. It opens the tree for sessions, windows, and panes; press / inside the chooser to search/filter, then Enter to switch.

Keep Ctrl+b s for a simple session overview unless you specifically want a dedicated session-only chooser.

Pane Management

Default ShortcutModification ShortcutAction
Ctrl+b %`Ctrl+Space`
Ctrl+b "Ctrl+Space -Split pane horizontally
Ctrl+b arrowAlt+arrows or Alt+h/j/k/lNavigate panes
Ctrl+b oCtrl+Space oCycle through panes
Ctrl+b ;Ctrl+Space ;Last active pane
Ctrl+b qCtrl+Space qShow pane numbers
Ctrl+b zCtrl+Space zZoom/unzoom current pane (with prefix)
Alt+zAlt+zZoom/unzoom current pane (no prefix)
Ctrl+b !Ctrl+Space !Break pane into new window
Ctrl+b xCtrl+Space xKill current pane (with confirm)
Ctrl+b {Prefix S Left/hMove pane left
Ctrl+b }Prefix S Right/lMove pane right
Ctrl+b SpaceCtrl+Space SpaceCycle through layouts
Ctrl+b Alt+arrowCtrl+Space Alt+arrowResize pane

Copy Mode and Scrollback

Default ShortcutModification ShortcutAction
Ctrl+b [Ctrl+Space [Enter copy/scroll mode
Ctrl+b ]Ctrl+Space ]Paste from tmux buffer
Ctrl+b =Ctrl+Space =Choose paste buffer
Ctrl+b #Ctrl+Space #List paste buffers
Ctrl+b PgUpCtrl+Space PgUpEnter copy mode and scroll up

Miscellaneous

Default ShortcutModification ShortcutAction
Ctrl+b :Ctrl+Space :Open command prompt
Ctrl+b ?Ctrl+Space ?Show all key bindings
Ctrl+b tCtrl+Space tShow clock (press q to exit)
Ctrl+b ~Ctrl+Space ~Show messages
Ctrl+b rCtrl+Space rReload config (if bound in config)

Changing the Prefix Key

Many users change the prefix to Ctrl+a (like GNU Screen):

~/.tmux.conf
# Unbind default prefix
unbind C-b

# Set new prefix
set -g prefix C-a
bind C-a send-prefix
note

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

~/.tmux.conf
# 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

Default ShortcutModification ShortcutAction
Ctrl+b ?Ctrl+Space ?Show all key bindings

From the command line:

tmux list-keys

Removing a Key Binding

~/.tmux.conf
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:

~/.tmux.conf
# 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!"

What's Next