tmux: A terminal multiplexer for daily use

A terminal multiplexer is a software designed to multiplex multiple virtual terminal sessions inside a single terminal window. Wikipedia describes it pretty accurate:

A terminal multiplexer is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session. It is useful for dealing with multiple programs from a command line interface, and for separating programs from the Unix shell that started the program.

You might already know GNU screen, the most well known terminal multiplexer in the UNIX world.

What is tmux?

tmux is a terminal multiplexer and alternative to GNU screen.

Screen was born in 1987 and there were a lot of fixes and enhancements, which led to a (sometimes) complicated and obscure code base.

Apparently one guy named Nicholas Marriott wasn’t happy about the code base of screen, and he began the development of tmux in 2007. Today tmux has a solid and extensible code base, and it’s maintained by several contributors on github.

How do I get tmux?

There are several options to get tmux.

You can download a release on github and compile it all yourself. This is the way to go if you like to have the latest version of tmux on your fingertips.

But there are also pre-compiled versions of tmux available on most current Linux distributions. I’m a Debian guy, so here’s how you install tmux on your Debian-based Linux distribution:

You can do the same on Ubuntu.

Right now I don’t have a RHEL, Fedora or CentOS at my disposal, but IMHO there’s no official package available for RHEL and CentOS – and I’m not even surprised by that ;). Though there’s an official Fedora package available. And for those using RHEL and CentOS, there are some manuals available, how you install tmux on RHEL & CentOS – or of course you switch to a proper Linux distribution 😉

How do I use tmux?

Well, this is quite a complicated topic, because tmux has so many features. I can’t really talk about all features, because it would be too complex – and to be honest, I don’t know them all!


Let’s start with the most important thing, how to open a new tmux session:

If you’ve disconnected from your tmux session, you can attach your existing session again:

Because tmux is pretty smart, you can even shorten your commands. For example instead of attach-session, you can simply type att or even  a is enough.

Status bar

As soon as you’ve started tmux, you should see a status bar on the bottom of your terminal. The status bar will show you the session name (or number), and the windows you’ve opened inside tmux. The current window is suffixed with an asterisk *, and the last window with a dash -.

Key bindings

When you’re inside a tmux session, you can start to benefit from tmux, by using key bindings to do awesome things. By default, all key bindings are prefixed by hitting Ctrl-B. So for example, if you want to create a new window, hit Ctrl-B c.


Tmux is based on windows. For simplicity’s sake, let’s say one window = one terminal. This isn’t completely true, but let’s say it is for now.

Here are some shortcuts for window management. Remember, you’ve to hit Ctrl-B first!

  • c creates a new window
  • x kills the current window
  • , renames the current window
  • n next window
  • p previous window
  • f find window with specific string
  • 0...9 jump to window 0…9

I could add several more shortcuts here, but I think these are the most important ones.


Now it gets a bit more complicated, because there are panes as well. We just dealt with windows so far, and I told you one window is one terminal. This isn’t completely true, because each window can hold several panes.

With panes you can split windows, so you can see multiple terminals in one single window / screen.

Let’s start with some basic key bindings:

  • % splits the window vertically
  • " splits the window horizontally
  • o loops through panes
  • cursor keys focus another pane (left/right/down/up)
  • z zooms the pane

When you’ve opened several panes, you can easily swap them:

  • { moves pane to left
  • } moves pane to right
  • space loops through layouts

To resize panes, it gets more complicated:

Hit the prefix (by default Ctrl-B) then :. Now you’re in command mode, and you can enter one of the following commands:

This will resize the current pane Down, Up, Left or Right.


Of course tmux is configurable by a config file, and you can configure nearly everything how you like it. By default, tmux will read the configuration file only when it wasn’t already running. Tmux tries to load the configuration files from  /etc/tmux.conf, then ~/.tmux.conf.

There are bazillion of configuration parameters. Here are some important ones:

When you’re configuring tmux, you don’t want to kill your whole tmux sessions just to reload the config. So add the following lines to your config:

Now you’ve to restart tmux or hit  Ctrl-B : reload-config ~/.tmux.conf at least once. From now on, you can edit your config and hit Ctrl-B r  to reload it.

tmux has also built-in mouse support, so let’s enable that:

Try to select a pane or window by clicking with the mouse on it. You should also be able to resize panes by drag n drop. Of course you need a terminal with built-in mouse support.

Also enable vi-style key bindings:

I do also like to hit Ctrl-B Ctrl-B to jump between to the last window:

And because I’m lazy, I sometimes forget to release the Ctrl key:

If you want to customise your status line, you can do that as well 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.