Skip to main content

Starting tmux

The simplest way to start tmux is to run it without any arguments:
This creates a new session with a single window. When tmux is started, it:
  • Creates a new session with a single window
  • Displays a status line at the bottom showing session information
  • Starts your default shell in the window

Creating Named Sessions

It’s useful to name your sessions for easier management:

The Prefix Key

tmux is controlled using a key combination of a prefix key followed by a command key. The default prefix is C-b (Ctrl-b).
To send a command to tmux, press the prefix key first, release it, then press the command key.

Common Commands

After pressing the prefix key (C-b), you can use these commands:

Sessions

A session is a single collection of pseudo terminals under tmux management. Sessions persist even when you disconnect.

Windows

Each session has one or more windows. A window occupies the entire screen and may be split into panes.

Window Navigation

Window Management

Or use key bindings:
  • C-b , - Rename the current window
  • C-b & - Kill the current window (with confirmation)

Basic Panes

Panes allow you to divide a window into multiple sections.

Creating Panes

The Command Prompt

Press C-b : to enter the command prompt. This allows you to run any tmux command interactively. Examples:

Getting Help

Press C-b ? to see a list of all key bindings.

Configuration File

tmux loads configuration from:
  1. /etc/tmux.conf (system-wide, if present)
  2. ~/.tmux.conf or $XDG_CONFIG_HOME/tmux/tmux.conf (user-specific)
The configuration file contains tmux commands executed when the server starts.

Basic Configuration Example

Reloading Configuration

After editing your configuration file:
Or bind it to a key in your config:
Then press C-b R to reload.

Common Workflows

Development Session

Create a development environment with multiple windows:

Remote Server Management

Sessions survive accidental disconnections, making tmux invaluable for SSH connections that might timeout.

Default Key Bindings Reference

Here’s a complete reference of the default key bindings (all require pressing C-b first):
  • d - Detach from session
  • D - Choose a client to detach
  • s - Select a new session interactively
  • $ - Rename the current session
  • ( - Switch to previous session
  • ) - Switch to next session
  • L - Switch to last session
  • c - Create a new window
  • & - Kill the current window
  • n - Move to next window
  • p - Move to previous window
  • l - Move to previously selected window
  • 0-9 - Select windows 0 to 9
  • ' - Prompt for window index
  • , - Rename current window
  • . - Prompt for window index to move
  • w - Choose window interactively
  • f - Search for text in windows
  • " - Split pane horizontally
  • % - Split pane vertically
  • o - Select next pane
  • ; - Move to previously active pane
  • q - Show pane numbers
  • x - Kill current pane
  • z - Toggle pane zoom
  • ! - Break pane into window
  • { - Swap with previous pane
  • } - Swap with next pane
  • Up/Down/Left/Right - Move to pane in direction
  • C-Up/C-Down/C-Left/C-Right - Resize pane by 1 cell
  • M-Up/M-Down/M-Left/M-Right - Resize pane by 5 cells
  • Space - Cycle through preset layouts
  • M-1 to M-7 - Arrange in preset layouts
  • [ - Enter copy mode
  • ] - Paste buffer
  • # - List paste buffers
  • = - Choose buffer to paste interactively
  • - - Delete most recent paste buffer
  • : - Enter command prompt
  • ? - List key bindings
  • t - Show time
  • i - Display window information
  • ~ - Show previous messages
  • r - Force redraw
  • C-z - Suspend tmux client