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 continue to run in the background, then later re-attached.

install and use tmux

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.

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 install tmux on Linux.

How To Install tmux on Linux

We’ll consider installation of Tmux on Arch Linux, Ubuntu, CentOS, Fedora, and Gentoo.

Install tmux on Arch Linux

Just run one of the following commands:

sudo pacman -S tmux --noconfirm

Install tmux on Ubuntu / Debian

To install tmux on Ubuntu or Debian system, use:

sudo apt-get update
sudo apt-get install tmux

Install tmux on Fedora / CentOS

For Fedora / CentOS system, use dnf and yum package managers respectively.

# Fedora
$ sudo dnf -y install tmux

# CentOS
$ sudo yum -y install tmux

How to use Tmux on Linux – CentOS, Fedora, Ubuntu, and Debian

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

Use the new sub-command with -s session to give it a name.

 $ tmux new -s test

Attach to named detached tmux session

If you detach tmux session, you can always re-attach using a command with -t option.

 $ tmux a -t test

Display tmux sessions

Show all active tmux sessions using the command.

 $ tmux ls

Rename session

The following command is used to rename an active session.

 $ Ctrl-b $

Provide session name and press enter key.

Switch session

Use this key combination to switch session.

 $ Ctrl-b s

Show tmux help screen (Q to quit)

Tmux help screen can be checked with:

 $ Ctrl-b ?
tmux show help

Press q key to exit.

Tmux Window management

Create a new window.

 $ Ctrl-b c

Destroy tmux 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 "

These are the most common tmux operations and commands you’ll need when working with tmux sessions. If you know of tmux commands not here, you can share on the comments section.

Related articles:

Ten Best Terminal Emulators for Linux

How to Share your Linux Terminal in Web Browser with GoTTY

How to Install and Use lazygit – A simple terminal UI for git commands

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here