Getting started with Tmux

Tmux stands for terminal multiplexer. It is basically a great tool to divide one terminal to many different virtual terminals which gives capabilities to do tasks such as system administration in parallel. This is particularly useful when you connect to a remote server. Tmux allows you to detach and attach to terminal from wherever you prefer without losing your data. It is more or less like saving your session, though it is not saving because the processes on the Tmux sessions continue to run. For those who are familiar with Screen command, I must say Tmux has more capabilities than Screen and you can do many things easily that are not very easy to do in Screen.

Tmux itself has a very comprehensive man page which covers each and every aspect.

However, for novice users going through all documentation to extract some most used commands might be cumbersome. Additionally, digesting of some commands require more explanation for beginners. Hence, in this post, I explain about the most basic and fundamental commands of Tmux.


Before starting going through installation process and the rest of story, I decided to explain slightly about the basic Tmux terminologies and structure.

Tmux session is container or superset that can contains multiple windows.

Tmux window is a subset of session and superset of pane. One window can hold multiple panes.

Tmux pane is the subset of window and smallest unit.

To understand the concept better, have a look at following image,


Attach to session refers to connecting to a Tmux session which is actively running.

Detach to session refers to disconnect from a Tmux session. Detaching from a session does not interfere running activities.

Switching to session refers to switch from one Tmux session to another Tmux session

Prefix key is a combination of keys that should be pressed before executing shortcut keys. Default prefix key is Ctrl + b.


The very first thing you need to do is to install Tmux. For Ubuntu users run following command in terminal,

$ sudo apt-get install tmux

OpenSUSE users need to use Zypper to install Tmux

$ sudo zypper install tmux

For other Linux distributions, please refer to related documentations on how to install Tmux or search on the Internet.


Tmux has a wide range of commands, in the following table list of the most basic commands with their description is provided.

Command Description
tmux new Creates a new Tmux session with no name
tmux new -s "test" Creates a new Tmux session named “test”
tmux attach -t "test" Attaches to Tmux session named “test”
tmux switch -t "test" Switches to a Tmux session named “test”
tmux ls Gets a list of available Tmux sessions
tmux kill-session -t "test" Kills a Tmux session named “test”
tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill Kills all Tmux sessions


Tmux has many keyboard shortcuts which are necessary to learn to be able to efficiently utilize it. List of must know is provided in below table.

Shortcut Description
Ctrl + b + d Detaches from the current Tmux session
Ctrl + b + o Switches between panes
Ctrl + b + o (Not release Ctrl key) Replaces panes
Ctrl + b + c Creates a window
Ctrl + b + % Creates a horizontal pane
Ctrl + b + " Creates a vertical pane
Ctrl + b + $ Renames the current Tmux session
Ctrl + b + ! Breaks the pane out of the window (Makes a separate window out of the pane)
Ctrl + b + ! Breaks the pane out of the window (Makes a separate window out of the pane)
Ctrl + b + (0-9) Switches between windows
Ctrl + b + t Shows the current time on the Tmux terminal
Ctrl + b + x Kills the current pane
Ctrl + b + z Toggles zoom state of the current pane
Ctrl + b + Ctrl + Arrow keys Resizes the active pane


Tmux official website (

Tmux man page (man tmux)

Tmux Wikipedia (

Tmux cheatsheet (

Leave a Reply

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