Skip to content
Go back

A Developer's Guide to Tmux - An Essential Cheatsheet

When I first started my career, Tmux quickly became my go-to tool for working with Linux servers. Its most powerful feature? It lets me keep tasks running in the background even after I disconnect from the network. Plus, it allows me to manage multiple workspaces inside a single terminal window, which is a huge boost to my productivity.

This cheatsheet covers the most common Tmux commands I use every day. It’s not a full-blown tutorial, but a quick reference guide to help you recall and use these commands whenever you need them.

Table of contents

Open Table of contents

How to Install Tmux

On most Debian/Ubuntu systems, you can get Tmux up and running with these two commands:

sudo apt update
sudo apt install tmux

Core Tmux Concepts

Before you start using the commands, it helps to understand Tmux’s three main concepts:

All actions are triggered by a Prefix Key, which is Ctrl + B by default. You press this prefix key, then the command key, to tell Tmux what you want to do.

Session Management

ActionCommandWhat it does
Create a New Sessiontmux new -s [session_name]Starts a new session with a name you choose.
List All Sessionstmux lsShows all your currently active sessions.
Attach to a Sessiontmux attach -t [session_name]Reconnects to a specific session.
Detach from a SessionCtrl + B, then DDisconnects from the current session without closing it.
Kill a SessionInside the session, type exit or Ctrl + DExits and permanently closes the current session.

Window and Pane Operations

Remember, you must hit the Prefix Key Ctrl + B before any of these commands.

ActionCommandWhat it does
Create a New WindowCCreates a new window in your current session.
List All WindowsWShows a list of all windows in the current session.
Switch WindowsN / PJumps to the next or previous window.
Select Window by Number0-9Quickly switches to a window using its number.
Split Pane Vertically%Divides the current window into two vertical panes.
Split Pane Horizontally"Divides the current window into two horizontal panes.
Switch PanesArrow KeysMoves your cursor between different panes.
Kill Current PaneXCloses the pane you are currently in.

Important Note: The command letters (C, W, N, P, X, etc.) are case-sensitive only in the document for clarity. When you actually use them, you should press the lowercase key (e.g., press c for C).

I hope this cheatsheet helps you work more efficiently with Tmux. Once you get these basic commands down, you’ll be able to switch between tasks and keep your work running without a hitch.


Share this post on: