tmux isn’t just a terminal multiplexer; it’s a way to keep your entire development environment running persistently, even when you close your laptop or SSH connection drops.

Let’s see it in action. Imagine you’re working on a project. You open tmux.

$ tmux new -s myproject

This creates a new session named myproject. Inside, you can open multiple windows.

# In tmux, press Ctrl+b then c to create a new window
# In tmux, press Ctrl+b then n to go to the next window
# In tmux, press Ctrl+b then p to go to the previous window

Each window can have multiple panes.

# In tmux, press Ctrl+b then % to split current pane vertically
# In tmux, press Ctrl+b then " to split current pane horizontally
# In tmux, press Ctrl+b then o to move to the next pane

So, in one tmux session, you can have a window for your backend code, another for your frontend, a third for database monitoring, and a fourth for running tests. Each window can have panes for different tasks within that domain.

The core problem tmux solves is session persistence and organized multitasking within the terminal. Without it, if you disconnect from an SSH session, all your running processes die. If you close your terminal window, your work is gone. tmux attaches your terminal session to a detached server process, allowing you to reconnect from anywhere.

Internally, tmux maintains a server process that manages sessions, windows, and panes. When you run tmux new or tmux attach, your terminal client connects to this server. The server keeps all your running applications alive.

Here are the key levers you control:

  • Sessions: A top-level container for your work. You can have multiple sessions for different projects or contexts. tmux ls lists your sessions. tmux attach -t session_name reconnects to an existing session.
  • Windows: Like tabs in a browser, but within a tmux session. Ctrl+b c creates a new window. Ctrl+b w shows a list of windows.
  • Panes: Splits within a window, allowing you to see multiple terminals side-by-side. Ctrl+b % (vertical split) and Ctrl+b " (horizontal split) are your friends. Ctrl+b <arrow key> navigates between panes.
  • Key Bindings: Ctrl+b is the default prefix. You can customize this. All commands start with Ctrl+b followed by another key.

Consider this common setup: in your primary window, you have a pane for your code editor (like vim or emacs), a pane for running your application, and a pane for git commands. In a second window, you might have panes for running unit tests, integration tests, and tailing logs.

# Example config: ~/.tmux.conf
# Set the prefix key to Ctrl+a
set -g prefix C-a
# Reload config
# Ctrl+a then r

# Split pane vertically with a hotkey
bind | split-window -h

# Split pane horizontally with a hotkey
bind - split-window -v

# Navigate panes with vim keys
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# Resize panes with vim keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

With these bindings, Ctrl+a | splits a pane vertically, Ctrl+a - splits horizontally, and Ctrl+a h/j/k/l navigate between them. Ctrl+a H resizes the current pane 5 columns to the left, and so on.

When you detach from a tmux session (usually Ctrl+b d), all the processes running within its windows and panes continue to run on the server. You can then log out, move to another machine, and re-attach to the same session using tmux attach -t session_name.

The tmux server itself can be restarted or killed, which will terminate all sessions. You can force-kill the server with tmux kill-server. Be aware that this is a hard stop for everything running under tmux.

The real power comes from scripting tmux to set up your entire development environment automatically when a session starts. You can use .tmux.conf and even external scripts to create specific window and pane layouts, run commands in each pane, and attach to specific directories.

Beyond basic pane management, tmux supports features like synchronized panes, where typing in one pane broadcasts to all other panes in the same window. This is incredibly useful for running the same command across multiple environments or for demos.

A common misconception is that tmux is only for remote SSH sessions. It’s equally valuable for local development, providing a persistent, organized workspace that survives IDE restarts, accidental terminal closures, or even system reboots if tmux is configured to auto-start.

The next step is mastering tmux scripting and plugins to automate complex session setups and integrate with other tools.

Want structured learning?

Take the full Tmux course →