Bytes
ArrowsREWIND Our 2024 Journey

How AlmaBetter created an

IMPACT! Arrows
Web Development

Tmux Cheat Sheet: Commands, Shortcuts and References

Last Updated: 8th January, 2025
icon

Jay Abhani

Senior Web Development Instructor at almaBetter

Master Tmux with this ultimate guide on the Tmux cheat sheet! Learn essential commands and tips to boost your productivity on Ubuntu and Linux terminals today!

Tmux, short for "Terminal Multiplexer," is an indispensable tool for developers, system administrators, and anyone who spends significant time working in a terminal. Whether you're managing multiple tasks or need a robust solution for organizing your workspace, Tmux can help. This detailed Tmux cheat sheet covers essential commands, how to use Tmux on Ubuntu and Linux, and tips to streamline your workflow.

Introduction to Tmux

Tmux is a terminal multiplexer that allows you to run multiple terminal sessions within one window. You can split your terminal into panes, create multiple windows, switch between them, and manage them more efficiently. Tmux works well on various operating systems, including Linux, macOS, and even WSL (Windows Subsystem for Linux).

Basic Concepts

Before diving into the Tmux commands cheat sheet, let's familiarize ourselves with some essential Tmux concepts:

  • Session: A Tmux session is a collection of windows, which you can detach from and reattach later. You can have multiple sessions running at the same time.
  • Window**:** A window is a single screen within a session. Each window can have multiple panes.
  • Pane**:** A pane is a subdivision of a window, allowing you to split the terminal into multiple sections.

Starting Tmux

To start using Tmux, open your terminal and type:

tmux

This creates a new Tmux session. If you wish to create a session with a specific name, use:

tmux new-session -s session_name

Detaching and Reattaching

Detach from session**:** You can leave the session running in the background using the command:

Ctrl+b d

This allows you to return to the normal terminal prompt without killing your session.

Reattach to a session: If you want to return to a previous session, use:

tmux attach-session -t session_name

Or if you have only one session running, you can simply type:

tmux attach

Tmux Commands Cheat Sheet

Now, let’s dive into some of the most common Tmux commands that you'll need to know to maximize your efficiency. Tmux uses the prefix key, which is Ctrl + b by default. This means that all commands are preceded by pressing Ctrl + b. After pressing the prefix key, you can execute the desired command.

Managing Windows

Create a new window:

Ctrl + b c

This creates a new window in the current session.

  • Switch between windows:
  • Move to the next window:
Ctrl + b n
  • Move to the previous window:
 Ctrl + b p
  • Move to a specific window (replace n with the window number):
 Ctrl + b <window_number>
  • Rename a window:
 Ctrl + b ,
  • Close the current window:
 Ctrl + b &
  • List all windows:
 Ctrl + b w

Managing Panes

Panes allow you to split your terminal into multiple sections. This feature is great for multitasking and running several commands in parallel.

Split the window vertically (into two panes):

Ctrl + b %

Split the window horizontally**:**

Ctrl + b "

Navigate between panes:

  • Move to the left:
Ctrl + b Left Arrow
  • Move to the right:
 Ctrl + b Right Arrow
  • Move up:
 Ctrl + b Up Arrow
  • Move down:
 Ctrl + b Down Arrow

Resize panes: To resize a pane, first press Ctrl + b and then hold Ctrl while pressing the arrow keys to adjust the pane size.

  • Close the current pane:
 Ctrl + b x
  • Swap panes:
 Ctrl + b { or Ctrl + b }

Managing Sessions

Sessions are the heart of Tmux’s multitasking capabilities. Each session can hold multiple windows and panes.

  • List all sessions:
 tmux list-sessions
  • Create a new session:
 tmux new-session -s session_name
  • Attach to a session:
 tmux attach -t session_name
  • Detach from a session:
 Ctrl + b d
  • Kill a session:
tmux kill-session -t session_name

Tmux Ubuntu Cheat Sheet

Using Tmux on Ubuntu is essentially the same as using it on any other Linux distribution, but some Ubuntu-specific commands and methods are worth mentioning. If you’re running Tmux on Ubuntu, you can install it via the following command:

sudo apt-get install tmux

Once installed, you can begin using Tmux just as we described earlier. Here are some Ubuntu-specific tips for using Tmux effectively.

Start Tmux Automatically

To start Tmux automatically whenever you open a terminal, you can add the following command to your ~/.bashrc file:

# Start tmux automatically
if which tmux >/dev/null && [ -z "$TMUX" ]; then
  tmux attach-session -t main || tmux new-session -s main
fi

This will check if Tmux is installed and automatically attach to your main session when you open a terminal.

Managing Multiple Tmux Sessions

Ubuntu users often work with different environments in separate sessions. Here's how to organize your sessions:

  • Create a new session with a specific name:
 tmux new-session -s development
  • Attach to a session:
 tmux attach-session -t development
  • Kill a session:
tmux kill-session -t development

Tmux Cheat Sheet Linux

On Linux, Tmux works similarly to how it operates on Ubuntu, since Ubuntu is a Linux distribution. Below are some Linux-specific Tmux tips and commands to boost your productivity.

Check for Tmux Installation

Before starting, ensure Tmux is installed on your Linux machine. To check, type:

tmux -V

If Tmux is installed, this will return the version number. If not, you can install Tmux using the package manager for your Linux distribution.

  • For Debian-based distributions (Ubuntu, etc.):
 sudo apt-get install tmux
  • For Red Hat-based distributions (Fedora, CentOS, etc.):
 sudo yum install tmux
  • For Arch Linux:
 sudo pacman -S tmux

Launching Tmux on Linux

Once installed, you can start Tmux in your terminal as mentioned earlier:

tmux

This will launch a new session. If you want to launch a session with a specific name, use:

tmux new-session -s session_name

Switching Between Sessions on Linux

  • List sessions:
 tmux list-sessions
  • Switch between sessions:
tmux attach-session -t session_name

Conclusion

Tmux is a powerful tool for anyone who works in the terminal. Whether you're using it on Ubuntu, Linux, or any other operating system, understanding how to manage sessions, windows, and panes will make you much more efficient.

By mastering the commands outlined in this Tmux cheat sheet, you’ll be able to multitask like never before and organize your terminal workflows to suit your needs. Whether you're managing server environments or running complex tasks in parallel, Tmux will be an invaluable tool in your toolkit.

More Cheat Sheets and Top Picks

  • Official Address
  • 4th floor, 133/2, Janardhan Towers, Residency Road, Bengaluru, Karnataka, 560025
  • Communication Address
  • Follow Us
  • facebookinstagramlinkedintwitteryoutubetelegram

© 2025 AlmaBetter