tmux is a window manager that runs inside your terminal. Its two biggest wins are that work continues when your SSH connection drops and that a whole set of tasks can be saved and brought back.

Install and first run

  brew install tmux          # macOS
sudo apt install tmux      # Ubuntu/Debian

tmux new -s work           # start a session named "work"
  

To leave a session, press Ctrl+B then d (detach). Whatever was running on the server keeps running. To come back:

  tmux ls                    # list sessions
tmux attach -t work        # reattach
  

Three concepts

ConceptMeaning
SessionThe unit of work. One project, one session
WindowA tab inside a session
PaneA split within a window

Essential keys

Every shortcut starts with the prefix Ctrl+B, then the key.

KeyAction
cNew window
n / pNext / previous window
09Jump to window by number
%Split vertically
"Split horizontally
arrow keysMove between panes
zZoom the current pane / restore
xClose a pane
dDetach from the session
[Enter scroll mode (q to leave)

Sanding down the defaults

~/.tmux.conf:

  # Ctrl+A as the prefix; Ctrl+B is a stretch
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# resize and scroll with the mouse
set -g mouse on

# number windows from 1
set -g base-index 1

# splits open in the current directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

# reload the config
bind r source-file ~/.tmux.conf \; display "Config reloaded"
  

The pattern that matters

Running something long on a remote machine:

  ssh server
tmux new -s migration
./migrate.sh            # a job that takes hours
# Ctrl+B, d — now close your laptop; it keeps running
  

Check on it the next day:

  ssh server
tmux attach -t migration
  

Next

With sessions handled, cut the time spent finding commands and files → fzf

Last updated 19 Aug 2026, 00:00 UTC. history