Skip to main content

Overview

tmux allows commands to be bound to most keys, with or without a prefix key. When specifying keys, most represent themselves (e.g., A to Z). Special modifiers and keys are also supported.

Key Notation

Modifiers

  • Ctrl keys: Prefix with C- or ^ (e.g., C-b or ^b)
  • Shift keys: Prefix with S- (e.g., S-Up)
  • Alt/Meta keys: Prefix with M- (e.g., M-1)

Special Key Names

The following special key names are accepted:
  • Up, Down, Left, Right
  • BSpace (Backspace)
  • BTab (Back Tab)
  • DC (Delete)
  • End
  • Enter
  • Escape
  • F1 to F12
  • Home
  • IC (Insert)
  • NPage, PageDown, PgDn
  • PPage, PageUp, PgUp
  • Space
  • Tab

Binding Special Characters

To bind " or ' keys, quotation marks are necessary:

The Any Key

A command bound to the Any key will execute for all keys which do not have a more specific binding.

Key Tables

Keys are bound in key tables:
  • prefix: Default table for keys pressed after the prefix key (default C-b)
  • root: Table for keys pressed without the prefix key
  • copy-mode: Emacs-style key bindings in copy mode
  • copy-mode-vi: Vi-style key bindings in copy mode
  • Custom tables: Can be created and switched to with switch-client -T

bind-key

Alias: bind
Bind a key to a command.
flag
Alias for -T root. Bind the key in the root table (without prefix).
flag
Indicate this key may repeat. See the initial-repeat-time and repeat-time options.
string
Attach a note to the key (shown with list-keys -N). Pass an empty string to clear an existing note.
string
Specify the key table to bind the key in. Default is prefix.
string
required
The key to bind.
string
The tmux command to execute when the key is pressed.

Using -r and -N Without Command

The -r and -N flags can be used without a command to alter an existing binding.

Examples

unbind-key

Alias: unbind
Remove a key binding.
flag
Remove all key bindings in the key table (cannot be used with a key argument).
flag
Alias for -T root. Unbind the key from the root table.
flag
Do not report an error if the key is not bound.
string
Specify the key table. Default is prefix.
string
required
The key to unbind (unless -a is used).

Examples

list-keys

Alias: lsk
List key bindings.

Default Form

Lists keys as bind-key commands. All key tables are listed by default.
flag
List only the first matching key.
flag
With -N, list the command for keys that do not have a note rather than skipping them.
flag
List only keys with attached notes. Shows only the key and note for each key. Only keys in the root and prefix tables are listed by default.
string
Specify a prefix to print before each key.
string
List only keys in the specified key table.
string
List bindings for the specified key only.

Examples

send-keys

Alias: send
Send a key or keys to a window or client.
flag
Expand formats in arguments.
flag
Expect each key to be a hexadecimal number for an ASCII character.
flag
Send keys to the target client instead of the target pane, so they are looked up in the client’s key table.
flag
Disable key name lookup and process the keys as literal UTF-8 characters.
flag
Pass through a mouse event (only valid if bound to a mouse key binding).
flag
Reset the terminal state.
flag
Send keys to copy mode. The keys are interpreted as copy mode commands.
string
The target client to send keys to (with -K).
number
Repeat count for the key.
string
The target pane to send keys to.
string
Key name (e.g., C-a, NPage) or literal string. If no keys are given and the command is bound to a key, that key is used.

Examples

Repeating Keys

Keys bound with the -r flag may repeat. After the first press, if the same key is pressed again within the repeat-time interval (default 500ms), the command is executed again without requiring the prefix key.
number
Time in milliseconds for which the prefix indicator is shown after the prefix key is pressed (default 500).
number
Time in milliseconds for which a key bound with -r may repeat (default 500).

Example

Key Binding Best Practices

Avoid Conflicting with Shell Keys

Be careful not to bind commonly used shell keys in the root table, as this will affect normal terminal usage.

Use Descriptive Notes

Add notes to key bindings to document their purpose:

Organize Custom Key Tables

For complex configurations, create custom key tables: