tmux bind vs bind-key: What's the difference??

Quick Answer

bind and bind-key are identical commands in tmux - they're just aliases of the same function. You can use either format interchangeably in your configuration. The shorter bind is more commonly used due to brevity.

bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind-key r source-file ~/.tmux.conf \; display "Reloaded!"

Detailed Explanation

In tmux configuration, key bindings are defined using either the bind or bind-key command. These commands create shortcuts that combine the prefix key (typically Ctrl+b) with another key to execute a specific action.

Command equivalence:

bind and bind-key are functionally identical and can be used interchangeably. They are both aliases for the same internal command. This is similar to how set and set-option are equivalents, or setw and set-window-option.

Basic usage examples:

# These do exactly the same thing - reload tmux config with 'prefix+r'
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind-key r source-file ~/.tmux.conf \; display "Reloaded!"

# These also do the same thing - split window vertically with 'prefix+|'
bind | split-window -h
bind-key | split-window -h

Common flags and usage patterns:

-rEnables key repeating (press multiple times without pressing the prefix again)
-nCreates a binding without requiring the prefix key
-TSpecifies the key table (e.g., -T copy-mode-vi for vi-mode bindings)
-NAdds a note/comment to the key binding (helps with documentation)

Checking existing bindings:

To see all current key bindings in tmux, use:

Ctrl+b :list-keys

You'll notice that the output uses bind-key in its display, but this doesn't mean that bind-key is different or preferred over bind.

Unbinding keys:

Similarly, you can use either unbind or unbind-key to remove key bindings:

# These do the same thing - unbind the "l" key
unbind l
unbind-key l

Pro Tip

For readability in your tmux.conf, consider picking either bind or bind-key and using it consistently throughout your configuration. Most users prefer bind for its brevity, but it's purely a matter of personal preference.

Historical Note

In older versions of tmux documentation, you might see bind-key used more frequently. Modern documentation and examples tend to use the shorter bind form, but both remain fully supported.