Skip to main content
Back to blog

Terminal multiplexers: why tmux changed how I work

·3 min readDeveloper Tools

Before tmux, closing a terminal meant killing whatever was running in it. SSH sessions died when the connection dropped. Running multiple commands meant multiple terminal windows, each disconnected from the others.

tmux solves all of this. It is a terminal multiplexer: one program that manages multiple terminal sessions, keeps them running when you disconnect, and lets you organize them however you want.

The basics

Start a new tmux session:

tmux new -s work

You are now inside a tmux session named "work." Everything you run here persists even if you close the terminal window or disconnect from SSH.

Detach from the session (it keeps running in the background):

Press Ctrl+b then d

Reattach later:

tmux attach -t work

Your session is exactly where you left it. Running processes, open files, command history. All there.

Why this matters

SSH sessions survive disconnects. Start a long-running process on a remote server, detach from tmux, close your laptop, and the process keeps running. Reattach hours later and see the output. Without tmux, a dropped SSH connection kills everything.

Persistent workspace. I have a tmux session for each project. When I switch between projects, I detach from one and attach to the other. Each session has its own layout, running servers, and terminal history.

Splits and windows. tmux lets you split your terminal into panes (side by side or top/bottom) and manage multiple windows (like tabs):

# Split horizontally
Ctrl+b %
 
# Split vertically
Ctrl+b "
 
# Switch between panes
Ctrl+b arrow-keys
 
# Create a new window
Ctrl+b c
 
# Switch between windows
Ctrl+b n  (next)
Ctrl+b p  (previous)

My configuration

The default prefix (Ctrl+b) is awkward. I remap it to Ctrl+a which is easier to reach:

# ~/.tmux.conf
set -g prefix C-a
unbind C-b
bind C-a send-prefix
 
# Intuitive split bindings
bind | split-window -h
bind - split-window -v
 
# Mouse support (scrolling, pane selection)
set -g mouse on
 
# Better colors
set -g default-terminal "tmux-256color"
 
# Start window numbering at 1
set -g base-index 1
setopt -g pane-base-index 1
 
# Faster escape time
set -s escape-time 0

My typical layout

For development, I usually have three panes:

  1. Left (wide): Editor or main terminal for writing code
  2. Top right: Development server running
  3. Bottom right: Git commands and misc

This layout means I can see code, server output, and run commands without switching contexts. Creating it is four keystrokes after opening tmux.

Compared to a tiling window manager

Pop!_OS has a built-in tiling window manager that I use daily. tmux and a tiling WM complement each other:

  • The tiling WM organizes application windows (browser, editor, terminal)
  • tmux organizes terminal sessions within a single terminal window

I use the tiling WM for the big picture layout and tmux for terminal session management, especially on remote servers where the tiling WM is not available.

Getting started

Install tmux (sudo apt install tmux), start a session, and learn three things: how to split panes, how to detach/attach, and how to switch between panes. That covers 80% of daily use. Everything else you can learn as you need it.

Sources

Enjoying the blog? Subscribe via RSS to get new posts in your reader.

Subscribe via RSS