MeshWorld India LogoMeshWorld.

Tmux Cheat Sheet: Sessions, Panes, Windows & Config (2026)

Vishnu
By Vishnu
|Updated: Jul 30, 2026
Tmux Cheat Sheet: Sessions, Panes, Windows & Config (2026)

Tmux (Terminal Multiplexer) is an essential CLI productivity tool that enables developers and DevOps engineers to run multiple persistent terminal sessions within a single window, split screens into custom pane layouts, and detach background processes without losing state over SSH connections.

Mastering Tmux allows developers to decouple execution threads from physical terminal emulators, ensuring long-running database migrations, build scripts, or server logs remain active even if your network connection drops unexpectedly.

Key Takeaways

  • Use `Ctrl+b` (default prefix key) followed by command bindings to manipulate windows and split panes.
  • Attach and detach persistent remote sessions using `tmux attach-session -t <name>` to prevent lost work.
  • Leverage TPM (Tmux Plugin Manager) for session persistence across system reboots.
  • Customize `.tmux.conf` for mouse support, true-color terminal rendering, and Vim-style pane movement.

How do you create, list, attach, and manage persistent Tmux sessions?

Tmux sessions isolate terminal execution threads so background processes continue running even if your SSH or terminal connection drops. Managing sessions effectively involves creating named workspaces, listing active sessions, and reattaching after network disconnects.

bash
# Create a new named Tmux session
tmux new -s dev-server

# List all active background Tmux sessions
tmux ls

# Attach to an existing named session
tmux attach -t dev-server

# Detach from active session (returns to host terminal): Press Prefix then d
# Shortcut: Ctrl+b d

# Kill a specific named session
tmux kill-session -t dev-server

# Kill all active Tmux sessions across the machine
tmux kill-server

How do you split windows into interactive terminal panes?

Panes divide a single Tmux window into multiple resizable sub-terminals side-by-side or stacked vertically. By arranging log tailing, code editing, and system monitoring tools in adjacent panes, developers achieve high-density terminal efficiency.

Key Binding (after Prefix Ctrl+b)Action
Ctrl+b %Split current pane vertically into left and right
Ctrl+b "Split current pane horizontally into top and bottom
Ctrl+b Arrow KeyMove cursor focus to adjacent pane
Ctrl+b h / j / k / lMove focus to left / down / up / right pane (with Vim config)
Ctrl+b zToggle pane zoom (maximize active pane to full screen)
Ctrl+b xClose / kill current active pane
Ctrl+b { / }Swap current pane position with previous / next pane
Ctrl+b Alt+ArrowResize active pane in 5-character increments

How do you manage multiple windows inside a single Tmux session?

Windows function as tabs inside a Tmux session, allowing you to organize server logs, code editors, and database shells into separate named views. Switching between windows requires pressing the prefix key followed by the window index or navigation key.

bash
# Create a new window inside active session: Press Prefix then c (Ctrl+b c)

# Rename current window: Press Prefix then , (Ctrl+b ,)

# Switch to next window: Press Prefix then n (Ctrl+b n)

# Switch to previous window: Press Prefix then p (Ctrl+b p)

# Jump directly to window number 2: Press Prefix then 2 (Ctrl+b 2)

# List all windows interactively: Press Prefix then w (Ctrl+b w)

A modern .tmux.conf enables mouse scrolling, 24-bit true color rendering, Vim-style keybindings, and custom status bar styling. Configuring these options transforms Tmux into a streamlined development workspace.

plaintext
# Set default prefix key to Ctrl+a (easier than Ctrl+b)
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# Enable full mouse support for selecting panes & scrolling
set -g mouse on

# Enable 24-bit true color support
set -g default-terminal "screen-256color"
set -as terminal-overrides ",xterm-256color:Tc"

# Start window and pane indexing at 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1

# Split panes using standard | and - keys
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# Vim-style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

Frequently Asked Questions

How do I scroll up and copy text in a Tmux pane?

Press Ctrl+b [ to enter Copy mode. Use arrow keys or Vim keys (k/j) to scroll through buffer output. Press Space to start text selection, Enter or y to copy text, and Ctrl+b ] to paste copied text.

How do I keep Tmux sessions active across system reboots?

Install TPM (Tmux Plugin Manager) along with the tmux-resurrect and tmux-continuum plugins. This automatically saves session layouts every 15 minutes and restores them upon system restart.


Share_This Twitter / X
Vishnu
Written By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Enjoyed this article?

Support MeshWorld and help us create more technical content