I have started using tmux but I feel that using Ctrlb0-9 is very annoying, because it's used so often.

How do I bind the keyboard so I only need to do Ctrl0-9 for changing windows (like in Chrome)?

I have tried to configure it in the .tmux.conf, but without any success.

this is my current .tmux.conf file

bind C select-pane -t :.+
set -g status-bg black
set -g status-fg white
  • The shortcuts are as simple as explained, Ctrl+[1-9] for tab [1-9]. The difference between them is that it currently does not work, and 'bind C select-pane -t :.+' was just something i tried out Oct 21, 2013 at 14:15

2 Answers 2


Several of the Control+digit keystrokes generate fairly standardized sequences, but not all of them do.

Here is what I found in the xterm that I had handy:

C-1: 1  (i.e. not different form a plain 1 keystroke)
C-2: ^@
C-3: ^[
C-4: ^\
C-5: ^]
C-6: ^^
C-7: ^_
C-8: ^?
C-9: 9  (i.e. plain 9)
C-0: 0  (i.e. plain 0)

The same sequences are generated in iTerm 2 (although this is highly configurable).

If your terminal emulator generates similar sequences, then you could bind most of them (though you need to use the standard, non-numeric “names” for the keys, e.g. C-@ or ^@, et cetera). You will have to find a way to configure your terminal to send some kind of sequence for any keystrokes that do not already send something different from the unmodified key (i.e. like 1, 9, and 0 above).

However, binding these keys without a Prefix (bind -n …) will probably break lots of stuff. Specifically, ^[ is the Escape character (used in almost all terminal control sequences), ^? is usually the Delete character, ^@ (as C-Space) is commonly used in Emacs(-style) editing, et cetera.

Probably a better approach is to configure your terminal to send the xterm-style “modifyOtherKeys” sequences that tmux 1.8 recognizes (if your xterm supports this, tmux automatically asks for this to happen):

C-1: ^[[27;5;49~
C-2: ^[[27;5;50~
C-3: ^[[27;5;51~
C-4: ^[[27;5;52~
C-5: ^[[27;5;53~
C-6: ^[[27;5;54~
C-7: ^[[27;5;55~
C-8: ^[[27;5;56~
C-9: ^[[27;5;57~
C-0: ^[[27;5;48~

The tmux names for these keys are exactly C-0, et cetera.

Note: These key names and sequences are not recognized by tmux versions older than 1.8.

You would bind them like this (in your .tmux.conf):

bind-key -n C-0 select-window -t :0
bind-key -n C-1 select-window -t :1
bind-key -n C-2 select-window -t :2
bind-key -n C-3 select-window -t :3
bind-key -n C-4 select-window -t :4
bind-key -n C-5 select-window -t :5
bind-key -n C-6 select-window -t :6
bind-key -n C-7 select-window -t :7
bind-key -n C-8 select-window -t :8
bind-key -n C-9 select-window -t :9
  • "if your xterm supports this, tmux automatically asks for this to happen" - could you briefly elaborate/mention the mechanism by which tmux accomplishes this?
    – Charles
    Mar 7, 2014 at 20:03
  • @Charles: tmux 1.8 sends the sequence ^[[>4;1m to enable the modifyOtherKeys functionality (see XTerm Control Sequences, search for modifyOtherKeys). However, tmux 1.9 no longer send this sequence. Mar 8, 2014 at 6:50

@ChrisJohnsen answer is perfect, however some people might want some help on how to setup Iterm 2 keys in order to achieve this behavior.

First, go to "Iterm2 -> Preferences -> Profiles -> Keys" as in:

Iterm profile configuration

and then click on + symbol to add preset when some Ctrl+Number is not on the list (the format on the list will be ^number), as it is the case for the ^1, which is not available on the default list.

Press Ctrl+1 when selecting the keyboard shortcut and select "send escape sequence" as action. Then, add Chris Johnsen's escape sequences without the ^[, which will be added by the iterm2 action:

enter image description here

Later, repeat this procedure for all other control keys, editing those already existent.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .