How to Change tmux Meta Key to a Better One

The tmux tool, or the terminal multiplexer, is great for allowing you to run multiple terminals side by side. What’s even better is that you can somewhat customize its behavior using the tmux.conf file. The meta key is the prefix you press before you issue a command that controls tmux so you can, for instance, split the terminal in two. By default it is set to CTRL-B, and this is how you can change that.

First create the tmux.conf file in your home directory

$ vi ~/.tmux.conf

This will open the vi text editor where you can enter the contents of the file. To change the prefix to CTRL-Y, for example, you would enter this:

### command prefix

unbind C-b
set-option -g prefix C-y

Then save the vi file by pressing Esc and typing :wq

As you can see the unbind C-b option tells tmux to rescind the default keyboard shortcut, and the set-option -g prefix C-y tells it to set a new one as the prefix, which is CTRL-Y. So if you have a different shortcut in mind just replace C-y with something else, like C-Space for CTRL-Space, which might actually be a great option. If you want to bind the windows key you could try Super_L.

If you’re not sure which key codes represent which keys on your keyboard you might want to run xev and then press the desired keys to get their codes. The caveat is that for xev to work you’ll need to have X installed and running, which will be the case on any desktop Linux system.

See Also

  • tmux – terminal multiplexer
  • How To: getting started with tmux



Contact Me

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
03 Sep 2024

macOS Sequoia 15.0

02 Sep 2024

Video: Has This Worked Before?

24 Mar 2024

Homelab: Mac Pro 2013 32GB

Recent Tweets