Beginner’s guide to tmux

tmux is a terminal multiplexer. It allows you to run multiple command line commands on a single terminal. Never again will you need to open several terminals to execute a task or keep going back and forth between directories.

Installing tmux

tmux comes out of the box in some distributions. You can also install it by using most of the package management tool. There is the option to compile it yourself as well. Check out its installing wiki for more details.

Use cases

The tmux getting started states the main uses of tmux are:

  • Allow programs running on a remote server to be accessed from multiple different local computers.
  • Work with multiple programs and shells together in one terminal, a bit like a window manager.

Key concepts

The tmux getting started goes over the basic concepts and terminology tmux uses. The main ones to understand are sessions, windows and panes. One session has windows and each window has panes. Panes are where shells or commands are run.

Interacting with tmux

tmux has a lot of options and commands, the following sections present some of the commands and key bindings and by no means is an extensive display of all of its features.

Attaching clients

The first steps to interacting with tmux would be setting up a session in the server and attaching a client to it. This can be done by running:

$ tmux new-session -s <session-name>
$ tmux list-sessions
$ tmux attach-session -t <session>

list-keys and commands

You can check the current key bindings available by running <C-b> ? , every key binding is listed there. Key bindings mostly are composed of the key combination, the command triggered by the key binding and the key-table (consider it as a state) at which the combination triggers the command. Consider this default one as example:

bind-key -T prefix : command-prompt


Separating related activities into different sessions can be beneficial as there are by default only 10 direct key bindings for selecting the windows in them.


A window is composed of an index and a name, it is usually identified by its index.


Panes can run different commands and are shown together as part of a window to the user. This is useful in many situations, like editing a source file and compiling or tailing logs.

Copy mode

Copy mode freezes the active pane allowing you to search and copy the output of some command to a tmux buffer. The key bindings to navegate in copy mode depends on the mode-key option, which is set as state by the manual:

mode-keys [vi | emacs]
Use vi or emacs-style key bindings in copy mode. The default is emacs, unless VISUAL or EDITOR contains ‘vi’.


tmux can be configured through configuration file. By default it uses ~/.tmux.conf. There are a lot of options to configure and they are listed in the manual but the defaults work reasonably well.


This guide presented an introduction to some of tmux features to help anyone to start using it. Once you adopt it in your day to day activities you will not want to go back.

Developer, testable code advocate and command line tools enthusiast