Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use the Ctrl+B command prefix in tmux, however this clashes with Ctrl+B in less, which is used for scrolling up a file.

How can I get this to work? Do I have to set a different command prefix in tmux? I really don't want to have to learn new key bindings if I can avoid it.

share|improve this question
up vote 13 down vote accepted

Obviously you can't have two keys that do the same thing when both programs are listening. Tmux is going to get it first. You didn't specify which set of key bindings you don't want to re-learn, but you have to do something different because the same key is used for both apps.

If you only use it occationally in less you can just pass the real thing on by hit Ctrl+BB (that's Ctrl-B twice) in tmux to pass on a single Ctrl-B to the app in the current pane.

If you want to change the tmux binding to be something else (say like Ctrl+A like screen) you can add this to your `~/.tmux.conf file:

unbind C-b
set -g prefix C-a

If you want to use something else for less, the G key is usually bound to go to the top of the file already, so no changes necessary. If that change doesn't suit you, you can rebind keys using lesskey.

share|improve this answer
If I change the tmux binding to Ctrl+A, that will clash with beginning-of-command. I also have 'Ctrl+B+B' bound to previously selected window. – dogbane Aug 20 '11 at 16:26
@Caleb: In my tmux (Ubuntu 11.04 with the default config), "Ctrl+B B" does nothing (nor is it documented in the man page); one has to use "Ctrl+B Ctrl+B" to send a Ctrl+B to the application. (By contrast, screen defaults to using "Ctrl+A A" to send a "Ctrl+A" to the application.) Excellent answer, anyway. – Riccardo Murri Aug 20 '11 at 16:28
@RiccardoMurri: That's a nomenclature problem. I didn't leave a space in between B keys that would indicate letting up on the control. Normally with styled keys like that you would put a space or comma between keys if the control key was going to be released, but it's not a well defined standard. Some people don't even use the same + syntax... – Caleb Aug 20 '11 at 16:57
@dogbane: If you re-bound a double CTRL-B to something other than the default, that's your fault and you will either have to remap that, map the pass through version of CTRL-B to something else, or use a different key for less. – Caleb Aug 20 '11 at 17:11
@dogbane I use Ctrl+\ , but this is obviously a matter of personal preference. You won't like my choice if you don't have a way of typing Ctrl+\ on your keyboard without finger contortions. – Gilles Aug 20 '11 at 23:57

In tmux with the default configuration, pressing Ctrl+B twice sends one Ctrl+B to the application.

share|improve this answer

You can use the tmux command send-prefix. It will send your tmux key-binding prefix to the current window

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.