- Published on
Change Prefix to a different keyboard shortcut in Tmux
Tmux is one of the most useful tool when it comes to using using a linux terminal.
Tmux is a terminal multiplexer, it allows a user to access multiple terminals (or windows), each running a separate program, while providing a single screen to work on. Tmux is useful for running more than one command-line program at the same time, increasing productivity and the way you work.
The default keyboard shortcut for prefix is Ctrl-B
in most Operating Systems.
Change Tmux prefix key to a different key binding
Let's consider the case where you are using tmux and have the default keyboard prefix shortcut set to Ctrl-B
. Now, let's say you want to change it to Ctrl-A
like the GNU screen keyboard shortcut, you can set the following config in ~/.tmux.conf
file-
set-option -g prefix C-a
unbind-key C-b
bind-key a send-prefix
Save the file ~/.tmux.conf
and then reload tmux conf-
Ctrl-B
:
source-file ~/.tmux.conf
Now, you will see that the prefix has changed to the new keyboard binding Ctrl-A
To test it, just try to zoom and unzoom the pane in the window-
Ctrl-A + z
I hope you found this article useful, glad that you found it easy to change prefix shortcut key in Tmux. You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.