Tmux is a terminal multiplexer which enables a number of terminals to be created, accessed, and controlled from a single screen. Tmux may be detached from a screen and will still continue to run in the background, then later reattached.

Whenever tmux is started it creates a new session with a single window and displays it on screen. A status line at the bottom of the screen shows information on the current session and is used to enter interactive commands.

tmux

In this guide, I’m going to share with you Tmux cheat sheet to help you get started with tmux on Linux or Unix box. Before the cheat sheet section, let’s first have a look at how to instal tmux on Linux.

Install tmux on Linux

We’ll consider Arch Linux, Ubuntu, Fedora and Gentoo.

Install tmux on Arch Linux

Just run one of the following commands:

$ sudo pacman -S tmux --noconfirm
$ pacaur --needed --noconfirm --noedit -S tmux
$ yaourt -S tmux --noconfirm
Install tmux on Ubuntu

To install tmux on Ubuntu

$ sudo apt-get update
$ sudo apt-get install tmux
Install tmux on Fedora
$ sudo dnf  update && sudo dnf -y install tmux

After the installation, you can start using tmux. The following tips will give you heads on how to use tmux.

Start tmux

 $ tmux

Detach from tmux To detach from active tmux session, type control+b followed by d

 $ ctrl-b d

Restore tmux session To attach to detached tmux session, use:

 $ tmux attach 

Create new tmux session with name test

 $ tmux new -s test

Attach to named detached tmux session

 $ tmux a -t test

Display tmux sessions

 $ tmux ls

Rename session

 $ Ctrl-b $

Switch session

 $ Ctrl-b s

Help screen (Q to quit):

 $ Ctrl-b ?

Tmux Window management

Create window

 $ Ctrl-b c

Destroy window:

 $ Ctrl-b x

Switch between windows:

 $ Ctrl-b [0-9] or Ctrl-b Arrows

Split windows horizontally:

 $ Ctrl-b %

Split windows vertically:

 $ Ctrl-b "