Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

the ssh dropped, and my work was still there

Why a persistent tmux session on remote boxes means a dropped connection no longer kills a long-running job or a half-finished train of thought.

A keyboard in front of a terminal

The train went through a tunnel, the WiFi died, and the migration I'd been babysitting for forty minutes carried on without me. That's the whole pitch for tmux, and it took me an embarrassing number of years to fully commit to it.

The habit is simple. I never run anything long on a remote box in a bare shell any more. First thing after ssh, I attach to a named session:

tmux new -A -s work

The -A means "attach if it exists, create if it doesn't", so I don't have to remember which state I'm in. The connection can drop, my laptop can sleep, I can close the lid and walk to a meeting, and the session keeps running on the server with every process and every scrollback line intact. When I come back, same command, and I'm exactly where I left off.

The bit that actually changed my days isn't the crash protection though. It's continuity of thought. I keep one window for the thing I'm doing, one for logs, one for a scratch shell, and that layout survives across days. I stop losing the small mental context of "what was I in the middle of", because the panes still say what I was in the middle of.

I won't pretend the default key bindings are friendly. Ctrl-b is awful and I remapped it to Ctrl-a like everyone eventually does. But the payoff for ten lines of config is that "I lost my connection" stopped being a sentence I say. The work is on the server. It was never mine to lose.