Skip to main content
Settings
Search
Appearance
Theme Mode
About
Jekyll v3.10.0
Environment Production
Last Build
2026-06-25 04:45 UTC
Current Environment Production
Build Time Jun 25, 04:45
Jekyll v3.10.0
Build env (JEKYLL_ENV) production
Quick Links
Page Location
Page Info
Layout article
Collection hacks
Path _hacks/tmux-survival-subset.md
URL /hacks/tmux-survival-subset/
Date 2026-06-24
Theme Skin
SVG Backgrounds
Layer Opacity
0.6
0.04
0.08

tmux in 9 commands: the survival subset

tmux has a manual the length of a novella and a reputation to match. People bounce off it, decide it’s for wizards, and go back to opening seven terminal tabs and losing all of them when the laptop sleeps.

Here is the thing nobody tells you: the part of tmux that changes your day is about nine commands long. The other ninety pages are for people who want to script their window layouts, and you are not, today, that person.

This is the survival subset. Learn these nine, paste the config at the bottom, and you have the one feature that matters most — a terminal session that keeps running after you walk away, lose your SSH connection, or close the lid.

First, the one idea

tmux is a session that lives inside the server, not inside your terminal window. You attach to it to see it and detach to leave it running. Close the terminal, lose the wifi, reboot your router mid-deploy — the session and everything in it is still there when you come back. That’s the whole pitch. Everything below is only steering.

Almost every in-tmux command is a two-key combo: a prefix, then a letter. The default prefix is Ctrl-b. Hold both, let go, then tap the letter. We’ll fix the prefix to something less awkward in the config section; until then, Ctrl-b it is.

The three you type at the shell

These you run at a normal prompt, outside tmux.

1. Start a named session

```bash lh:norun tmux new -s work


You'll know it worked when your terminal gets a status bar along the bottom with `[work]` on the left. You're inside now.

**2. List your sessions**

```bash lh:norun
tmux ls

Run this from outside tmux to see what’s still running. Real output from a session named survival:

survival: 1 windows (created Wed Jun 24 23:48:09 2026)

That line is the magic. The session is sitting there, holding your work, whether or not any terminal is looking at it.

3. Reattach

```bash lh:norun tmux attach -t work


After a disconnect, a reboot of your local machine, or closing the terminal by accident — this drops you back exactly where you were. `tmux a -t work` is the short form. If you only have one session, plain `tmux a` attaches to it.

## The six you press inside tmux

Each of these is `prefix` then a key. With the default prefix that's `Ctrl-b`, then the letter.

**4. Detach — `prefix d`**

The most important keystroke in tmux. It leaves the session running and dumps you back at your normal shell. You'll see:

```console
[detached (from session work)]

Your commands keep running. This is the move you’ll use a hundred times. Detach, walk away, reattach tomorrow.

5. New window — prefix c

A window is a full-screen workspace, like a browser tab. prefix c creates one. The status bar grows a new entry. Make one per task — 0:edit 1:server 2:logs.

6. Jump between windows — prefix then a number

prefix 1 goes to window 1, prefix 2 to window 2, and so on. prefix n and prefix p step to the next and previous window if you’d rather not aim. You’ll know it worked when the highlighted entry in the status bar moves.

7. Split into panes — prefix % and prefix "

Panes split one window into side-by-side terminals. By default prefix % splits left/right and prefix " splits top/bottom. These two bindings are the single worst design decision in tmux — nobody remembers which quote-shaped key does which. We remap them to | and - in the config below, because then the key looks like the split it makes.

8. Move between panes — prefix then an arrow key

Once you have panes, prefix ← / prefix → / prefix ↑ / prefix ↓ move the focus. The active pane gets a brighter border.

9. Scroll back — prefix [

In tmux the mouse wheel doesn’t scroll the buffer by default (we fix that too). prefix [ enters copy mode, where the arrow keys and Page Up walk back through everything that scrolled off. Press q to get out. This is how you read the error that flew past during a build.

That’s nine. Start, list, attach; detach, new window, switch windows, split, move, scroll. With those you can live in tmux indefinitely and never lose work to a dropped connection again.

The six-line config that makes it sane

Out of the box, tmux’s defaults fight you. This is the smallest ~/.tmux.conf worth having. Every line earns its place; there’s no theme soup here.

# Use Ctrl-a as the prefix instead of Ctrl-b (your thumb will thank you)
unbind C-b
set -g prefix C-a
bind C-a send-prefix

# Turn the mouse on: click panes, drag borders, scroll the buffer
set -g mouse on

# Count windows and panes from 1, because the 0 key is miles away
set -g base-index 1
setw -g pane-base-index 1

# Split with | and - so the key matches the picture in your head
bind | split-window -h
bind - split-window -v

# Reload this file without leaving tmux
bind r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"

# Keep scrollback worth scrolling
set -g history-limit 10000

Save it to ~/.tmux.conf. If tmux is already running, load it once by hand — from inside a session, run tmux source-file ~/.tmux.conf. (The prefix r shortcut can’t bootstrap itself: the bind r line doesn’t exist until the file is sourced.) From then on, prefix r reloads the file any time and flashes tmux.conf reloaded so you know it took.

To prove the file actually takes effect rather than taking it on faith, you can ask tmux what it thinks its settings are:

$ tmux show-options -g prefix
prefix C-a
$ tmux show-options -g mouse
mouse on
$ tmux show-options -g base-index
base-index 1

That’s the real output from a server started with exactly the config above. Prefix moved, mouse on, counting from 1. Now prefix | splits left/right, prefix - splits top/bottom, and your scroll wheel works like a scroll wheel.

The part where it breaks

Here’s the gotcha that sends people back to browser tabs, and it’s the very first line of the config we pasted above.

Moving the prefix to Ctrl-a is the most common tmux tweak on the internet. It’s also a collision. In a normal shell, Ctrl-a is the readline binding for “jump to the start of the line” — the one you press all day without thinking about it. Remap the prefix to Ctrl-a and tmux eats that keystroke. You press Ctrl-a to fix a typo at the start of a command, and tmux sits there waiting for the second half of a combo that isn’t coming.

The fix is the third line:

bind C-a send-prefix

That says: when I press the prefix key twice (Ctrl-a Ctrl-a), send a literal Ctrl-a through to whatever’s running. So your “jump to start of line” still works — it costs one extra tap now. Annoying, but muscle memory absorbs it in a day.

If that trade isn’t worth it to you, the honest answer is: don’t move the prefix at all. Ctrl-b is fine. It’s only a hair more awkward, and it collides with nothing. Delete the first four lines of the config and keep the rest. The mouse, the sane split keys, and counting from 1 are the changes that actually pay off every day — the prefix swap is the one that’s purely taste, and it’s the one that bites.

The honest accounting

tmux will not “10x” anything. What it does is narrow: it makes a terminal session outlive the terminal. That sounds small until the first time a deploy is twenty minutes in, your wifi drops, and instead of a ruined afternoon you type tmux a and watch it carry on exactly where it was.

Nine commands and six lines of config bought you that. Everything else in the manual is optional. Go start a session called work and detach from it, then watch it keep running without you.