What's the least conflicting prefix/escape sequence for screen or tmux?

I think ^\ (a.k.a. ^|) is the best if it's in a convenient position on your keyboard layout. Its uses in other programs are quite rare:

  • sending SIGQUIT to a process
  • aborting for or while loops in a shell when ^C is intercepted
  • toggle-input-method in emacs

I don't know of any other uses. Be careful to not accidentally kill a processes outside of tmux or screen after getting used to it. It happened to me only once in a few years though.

~/.tmux.conf

unbind-key C-b
set -g prefix 'C-\'
bind-key 'C-\' send-prefix

~/.screenrc

escape ^|^|

For people who want to use backtick as the escape in tmux, you'll want to add:

unbind C-b
set -g prefix `
bind-key ` send-prefix

That last one is important, else you can't type a backtick for other purposes :-)


Ctrl+A is also known to cause problems with Emacs, including Bash in Emacs mode. It sounds like this is not a problem for you.

Ctrl+O is the other option I've seen. Apparently, this is the default in RatPoison (this is an X window manager that doesn't need a mouse). I've used Ctrl+O when using nested screens: Ctrl+O for the outer one and Ctrl+A for the inner ones. Worked well, but kinda scared my colleagues. :-)

I was just thinking and if you use vi rather than Emacs, there are a few alternatives. Ctrl+G isn't used by much, for instance.