Linux Applications

How to Update tmux Configuration File

Tmux is a terminal multiplexer which you can create multiple terminal windows. It enables you to perform different tasks on different terminal screens without problems. The advantage of using tmux is that you can increase your productivity by manifolds as you are not bound to use only one terminal.

While working with tmux, there are commands and features that you can use to operate tmux and make some changes to the way it works. The commands through which you control tmux are preceded by “Ctrl+b” without which you can’t run any tmux commands.

Now, it can be annoying or difficult to press “Ctrl+b” every time to enter a tmux command and some might want to change how some of the tmux features look and work.

The good news is that tmux is customizable and you can choose to have whatever shortcuts to the tmux commands. The customization can be done by editing the tmux configuration file (tmux.conf) and reloading it to save the changes.

If you are using tmux and are searching for a way to customize tmux, your search ends here. This article will be going through the ways you can customize tmux, examples of some commands that you can change, and the commands you need to use to implement those changes.

Using the Mouse Mode

Let’s suppose you are working on the tmux windows and have written long scripts of codes and commands on the terminal. If you want to move upwards to have a look at a script you typed in, you will have to navigate upwards using the arrow keys which can be time-consuming and annoying. Luckily, to sidestep this problem, tmux has provided us with the choice of using the mouse to scroll upwards and downwards. We all can agree that navigating using a mouse is easier than using the arrow keys. Thus, if you want to use your mouse for scrolling in tmux sessions, follow these steps:

1. Open the terminal.
2. In the terminal, type the following command to open the tmux configuration file:

$ sudo nano ~/.tmux.conf

Nano is the default text editor that comes with the Linux command terminal. You can use any command-line text editor of your choice.
3. Once the configuration file is open, type in the following line:

set -g mouse on


4. After typing in this line, save the changes you made and execute the following command so that the configuration file can be updated:

$ tmux source-file ~/.tmux.conf


This command will be used every time you make changes to the tmux configuration file. If you don’t, the changes you make won’t be implemented.

Changing the Prefix

As mentioned before, in order to use the tmux commands, you need to press “Ctrl+b” to execute most of them. Now, if you want to change this prefix according to your choice, you can do that as well. However, there are some restrictions as you can’t change it to any other key or combination because the key you choose might be used for another command.

One of the options you do have is to change the prefix to “Alt+b”. If you want to do that or you want to change the prefix to something else follow these steps:

1. Open the terminal.
2. Use this command to open the configuration file.

$ sudo nano ~/.tmux.conf

3. Once the file is open, type in the following lines:

unbind C-b
set-option -g prefix M-b
bind-key M-b send-prefix


4. You can also choose to keep both as prefixes using the following lines:

set-option -g prefix M-b
set-option -g prefix2 C-b


5. After you have entered these lines, save the changes and exit the file. Next, run this command to implement the changes:

$ tmux source-file ~/.tmux.conf


Creating a Shortcut for Reloading Configuration File

As previously mentioned, you need to reload the configuration file every time you want to implement a change made to it. For a person who makes a lot of changes, this can prove to be a hurdle. One option to overcome this is to create a shortcut for it in the configuration file. If you want to do that, follow these steps:

1. Open the terminal.
2. Open the configuration file.
3. In the configuration file, add these lines:

bind u source-file ~/.tmux.conf


4. After saving and reloading the configuration file, if you want to reload the configuration file, you can use the prefix key determined by you and then press the “u” key to reload it. You can choose to have any key you want, just make sure you don’t use a key meant for another command.

Customizing the Split Pane Commands

The tmux commands for splitting panes are somewhat awkward to implement. For example, if you want to split the pane horizontally, you need to press “Prefix + ” ”. If you want to make the splitting pane commands easier to implement and understand, follow these steps:

1. Open the terminal.
2. Open the configuration file.
3. In the configuration file, type in the following lines:

unbind '"'
unbind %
bind h split-window -h
bind v split-window -v


4. After saving and reloading the configuration file, you can now split the panes horizontally and vertically using the prefix in combination with “h” and “v” respectively.

So, these are some of the ways you can customize tmux commands.


This article was on how to update the configuration file to implement changes made to tmux commands and features. Tmux is very convenient in the regard that you can easily unbind combinations and make new combinations to your liking. We hope that we were able to help you out in understanding how you can create new customized commands.

About the author

Zeeman Memon

Hi there! I'm a Software Engineer who loves to write about tech. You can reach out to me on LinkedIn.