Command-Line Interface — tmux. A high-level overview of terminal… | by William Leiby | Feb, 2022

A high-level overview of terminal emulator instance management with tmux.

William Leiby
Building with tons of windows
Photo by Pierre Chatel-Innocenti on Unsplash

By definition, tmux is what is known as a “terminal multiplexer.”

What is a terminal multiplexer?

By definition, a terminal multiplexer is:

“A software application that can be used to multiplex several separate pseudoterminal-based login sessions inside a single terminal display, terminal emulator window, PC/workstation system console, or remote login session, or to detach and reattach sessions from a terminal.”


To provide you with a bit more of a comprehensible understanding of tmux and terminal multiplexers as a whole, they’re essentially glorified window and session managers for your terminal emulator that drastically increases the efficiency at which you can traverse different file systems. They allow the user to split panes both vertically and horizontally, manage multiple windows within a single instance, as well as create nested instances within already existing sessions.

According to tmux’s GitHub repository Wiki:

“It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal. And do a lot more.”


If youre wondering why you may want to use a tool like tmux, here’s a pragmatic example that will hopefully solidify my reasoning for the use case for it:

Let’s say you have one or more computers that you may want to access specific files within each of their file systems. We can assume that one of those machines is your local computer, whether that is a laptop or a desktop of some sort, but what about the other machines?

Maybe you have a server that’s hosted by a service like AWS or DigitalOcean that’s running a Unix-like operating system such as Ubuntu and you want a way to manage the files associated with said file system without actually accessing the computer physically. This, of course, is where SSH comes in, but after SSH’ing into the server and whatever work you have wished to complete, what if you know in the future that you will need to come back to this file system on this computer ? What if you needed to access multiple servers across multiple computers?

Managing these SSH sessions with a potentially large amount of different computers would be a nightmare if you didn’t have a tool like tmux readily available to you.

Tmux allows you to create a new session, then within each session, you’re able to have multiple windows. Within each of those windows, you could have a different file system dependent upon which computer you wish to access. Now, you no longer have to run redundant Unix scripts to get back to where you originally once were.

This, of course, isn’t the only way to architect tmux for your personal use. Tmux is robust enough to allow you or your team to create a multiplexer workflow that will work for any scenario.

Before actually jumping into tmux and using it for the first time, you will first need to get it on whatever machine you are using. Here are the most common ways of doing that:

Homebrew (Recommended for macOS Users):

brew install tmux


git clone
cd tmux
./configure && make

After the installation has taken place, you may have to restart your terminal emulator for the tmux command to be available for you to use. Simply quit out of your existing terminal emulator and reopen a new window or run the following Bash command in your terminal:


If neither of those options works for whatever reason, you can source your preferred shell’s resource file (example of sourcing a .bashrc file on a Unix-like machine):

source ~/.bashrc

Hopefully, you now have tmux installed on your machine and you’re ready to start using it! One of the first things you can do with tmux is to simply write the tmux command in your terminal emulator of choice:


This will bring you into a new tmux session with the name being the index of the session you are a part of. If it’s the first time you’re using tmux on your machine, you should have the index of either 0 or 1, depending upon what your .tmux.confsays to be the preferred number to index at.

Your .tmux.conf file is your configuration settings for all of tmux. It can be found at the root user directory of your computer, ~/ for macOS machines, and can only be seen if you have hidden files enabled on your machine. If you don’t have hidden files enabled, here’s are some resources for helping you enable them depending upon the machines you may be using.

Once you have enabled hidden files to be visible on your computer, you should now be able to see the .tmux.conf file. Don’t worry too much about this file just yet if you’re new to tmux. We will come back to this file when we start customizing tmux (that will make more sense further into the article).

Now that tmux is installed on your machine and you have hidden files enabled on your system, let’s jump into

Favorite tmux commands

All of these commands will only execute if the user is inside of a session. All commands are also prefixed with the keyboard shortcut ctrl + b.

  • — Splits your current tab horizontally.
  • % — Splits your current tab vertically.
  • Arrow Keys — Allows for navigation between panes.
  • $ — Rename your current session.
  • — Rename your current tab.
  • s — Switch between sessions.
  • d — Detach from the existing session.
  • x — Deletes a pane from your current window.
  • & — Deletes a tab in your current session.
  • c — Creates a new tab in your current session.
  • r — Restarts your current session.

For a full list of all the tmux commands you can execute once inside of a session, please refer to this link.

Customizing tmux

On its own, tmux is a very versatile and robust tool for the problem it aims to solve, but we are able to take the multiplexer one step further through personalization to better suit the everyday programmer. Although you’re able to modify tmux and morph it into a tool that is best tailored to your own wants and desires, here is a list of all the things I do to make tmux my own:

  • Change the default ctrl + b keystroke to ctrl + a .
  • Add plugins that offer features that don’t exist out-of-the-box with tmux.

Here are the ones I use:

If you’re looking for a comprehensive list of tmux plugins, feel free to check out these two GitHub links:

In order to actually make any changes to your tmux configuration, you’re going to need to open up the .tmux.conf file that should be at the root of your user’s file system. On macOS machines, that would be ~/ .

If you’re looking to go out on your own and customize tmux from the ground up, feel free to check out this blog post from Ham Vocke on how to customize your own .tmux.conf .

If you’re interested in altering tmux to your liking from a top-down approach, feel free to check out this popular tmux configuration from gpakosz on GitHub.

All in all, tmux is a great tool if you’re looking to increase your workflow and you use a command-line interface on a daily basis. Quickly being able to traverse multiple file systems not only helps in increasing a user’s productivity, but also aids in compartmentalizing particular projects, or even entire systems.

Although it has an awkward learning curve at first, once acquired, it will be incredibly unlikely that you will ever go back to using a terminal emulator again without a multiplexer to some degree.

If you’ve found any errors at all, feel free to leave a comment. I’ll try to get back to you as soon as possible.

Thank you for your time and attention.

Leave a Comment