Linux Commands

How Do I Change My Theme on tmux?

Being fast, convenient, and versatile, the command terminal of the Linux distribution differentiates itself from those of other operating systems.

The command terminal accepts lines of text and then processes these texts into instructions for your computer. Simply put, it also allows users to execute a complex set of instructions in just a few lines.

This is one of the many examples of the command terminal that can make time-consuming and tiresome tasks easy. That being said, there may be times when having a single terminal screen might not be enough for your tasks. Worry not, as we’ve got you covered.

Introducing tmux, a tool developed by Nicholas Marriot in 2007 that enables you to open and manage multiple command terminal sessions simultaneously at a single instance. tmux enables you to create, manage as well as navigate through multiple terminal windows simultaneously.

One of the most prominent features of tmux is the customizability it offers. tmux allows you to change the themes to ensure that you’re working in an environment that fits your preference. This guide will help you learn how you can change your theme in tmux. Let’s take a look at the steps.

Installing tmux on Linux

First and foremost, it is recommended for you to ensure that tmux is available on your system.

This can be done with the help of the command terminal with the help of the –version option.

For this guide we’ll be using Ubuntu 20.04 LTS as our Linux distribution. However, the procedure should be similar for all distributions with a slight change in syntax. To verify if tmux is available on your Linux distribution, follow these steps:

First, open the command terminal on your main Linux distribution. The shortcut key is Ctrl + Alt + T.

After that, type the following command on your terminal to see if tmux is installed:

$ tmux –version

If the above-mentioned command doesn’t return a tmux version as the output, then install tmux by typing the following:

For Ubuntu:

$ sudo apt install tmux

For CentOS:

$ sudo yum install tmux

Patiently wait for the installation to complete as it can take a while. Once it’s done, you can move on to the next step.

Starting a tmux Session

The next step is to start a tmux session. This can also be achieved using the Linux command terminal as explained below.

To start tmux, type the following in the terminal:

$ tmux

This should open up tmux on your Linux distribution. In case tmux doesn’t start, check whether it has been installed correctly by typing $tmux –version in the terminal again. If it doesn’t display the version number, then reinstall tmux as mentioned in the previous section.

Customizing Your tmux Themes

As mentioned above, tmux is a program that enables its user to execute and control numerous terminal sessions simultaneously. This section of the guide will help you learn how you can customize and theme tmux the easy way.

tmux makes use of keyboard shortcuts, otherwise known as prefixes. These shortcuts are certain combinations of keyboard buttons that are used to execute different types of functions.

By default, tmux does not have a great appearance but you can change your theme according to your preference. You can pretty much customize anything; whether it’s the colors or the style of your status bar, tmux has you covered. You can also toggle between dark and light themes by following simple instructions.

To change your theme tmux, it is advised to split your configuration file for tmux into two different files. The first contains [~/.tmux.conf ], and the other file [~/.tmux.THEMENAME.theme ] only contains the theming variables for visuals. Doing this makes it easy for you to switch between different themes.

You can load a theme that depends on the environmental variable by adding the following lines to the main configuration file for tmux.

$ run-shell “tmux source-file ~/.tmux.\${TMUX_THEME:-default}.theme”

$ TMUX_THEME is the environment variable based on which the file containing the tmux theme is called upon dynamically. In the case of an empty environment variable, tmux loads a generic theme by default: ~/.tmux.default.theme

You can also load different themes. The process is easy and can be achieved within tmux using the source-file:

$ tmux source-file ~/.tumux.THEMENAME.theme

In case you wish to remove the tmux theme, you can remove the tmux configuration file by typing the following in the command terminal.

$ rm ~/.tmux.conf

This will remove the tmux.conf file. Bear in mind that by removing this file, you’ll also be getting rid of all your customizations. This includes custom visuals, keybinds, themes, and etc.

Conclusion

This concludes our guide on how you can change your theme on tmux. We went over the basics of tmux, the steps to start a new session, and then concluded with how to customize and change the theme on tmux.

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.