The open-source terminal multiplexer Tmux is designed for Unix-like operating systems. It enables the use of several terminal sessions in a single window simultaneously. It is handy for executing many command-line programs concurrently. The GNU screen can be replaced with the terminal multiplexer Tmux. A Tmux session may be created, and many windows can be opened inside of it. Each window occupies the entire screen and has two rectangular panes. Users can start a process, change to another, disconnect, and return to an ongoing process.
Tmux makes it simple to move between several apps on one terminal and to detach and reattach them to another terminal. Because Tmux sessions are persistent, they will still run even if you are disconnected.
Using Tmux
Tmux uses ideas like sessions, windows, panes, and hotkeys. Because of this, beginners typically find it intimidating at first. But once you’ve mastered it, you’ll feel much more productive. To simplify it, Tmux uses the following concepts:
A Tmux session is indicated by the extent of the job at hand. Windows permit users to carry out many tasks during a single session. On the other hand, Panes will let you work with several viewpoints within a single window. Tmux hotkeys, which consist of the Tmux prefix preceded by a specific key, may control all the concepts already mentioned, such as panes, windows, and sessions. The default Tmux prefix is “Ctrl + B.”
How to change colors in Tmux
Tmux has more features than you thought. This application provides choices for graphic customization. By making minor adjustments to the configuration file, it is possible to modify the text, layout, and colors on Tmux. However, you could become confused about how changing certain window portions to your preferred colors might enhance your Tmux experience. This tutorial guide will demonstrate how to change colors in Tmux. Therefore, stick to the end if you wish to learn more about this subject matter.
How to start a Tmux session
We first have to invoke the Tmux application via the Gnome terminal, as illustrated earlier in this article guide.
Run the following command to start Tmux:
tmux
Launching the Tmux application will initiate a tmux session, as displayed in the screenshot above.
Once you are done, launch the Tmux configuration file by executing this line of code:
sudo nano ~/.tmux.conf
This command will launch the tmux.conf file we shall use throughout this article guide to customize and change the colors of our Tmux application.
How to customize panes in Tmux
A split session open in a single Tmux window is called a pane. You can open many panes in a single window with tmux. The following shortcuts can help you do this:
- Press Ctrl + B and type % to divide the tmux window into two vertical panes.
- Press Ctrl + B and type ” to divide the tmux window into two horizontal panes.
When you cycle through the various panes, you will see that the border window is emphasized in a dark green hue. By doing the following, you may change this to a color that is simple for you to see:
Make sure you are in your default home directory first. With the aid of the following command, you may print the directory that you’re now in:
pwd
The above command will print the directory you are in. To be on the same page with me, ensure you are in the default home directory. If you are not in that directory, use the cd command to navigate to the home directory.
Note: We shall be using a text editor to customize our Tmux configuration file. Therefore, stick to the default nano editor if you don’t know which one to use. Run the command below to launch the tmux.conf file:
sudo nano ~/.tmux.conf
Now we shall be customizing the pane border colors of our Tmux application. To do so, append the following lines to your tmux.conf file and save it. That will change the pane border colors of your Tmux application.
# Change the border colour of the pane highlight set -g pane-active-border-style fg=<color name> # Change the border colour of all panes set -g pane-border-fg <color name>
Example:
set -g pane-active-border-style fg='#6272a4' set -g pane-border-style fg='#ff79c6'
Check the effect of the above command
How to customize status bar styles in Tmux
The status bar’s design may also be modified with tmux. This also uses the tmux configuration file, just like the previous part did.
To alter your system’s status bar graphics, follow these steps:
Open the command terminal first, then launch a tmux session. After doing that, use the following command to access the tmux configuration file in the home directory:
sudo nano ~/.tmux.conf
Add the following line to the configuration file to alter the colors of the status bar:
set -g status-bg=<color 1>, status-fg=<color 2>
Once you reload the tmux.conf file, it will change your status bar style color according to your preference
Example:
set -g default-terminal "screen-256color" set -g status-bg black set -g status-fg gold
Output results:
Conclusion
This brief article guide covered various aspects regarding the Tmux application and how to change color. Although altering colors can seem like a bit of change, it can improve readability and the entire experience. Therefore, if you doubt how your application will look after customizing the color, why don’t you give it a try since it is free? Also, don’t forget to interact with us via the comments below in case of any complexities.