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

the session that survived the dropped connection

A short note on why tmux earns its place: a long-running job that survived a dropped SSH connection, and the two habits that make it stick.

A mechanical keyboard beside a terminal

The train went through a tunnel, the connection dropped, and I didn't care. That's the whole pitch for tmux, really. A migration was three hours into a six-hour run on a remote box, and a few years ago that would have meant a small heart attack and a nohup I'd forgotten to set up. Instead I reconnected, ran tmux attach, and there it was, still scrolling, none the wiser.

The mechanism is simple once it clicks: tmux runs the session on the server, detached from your terminal entirely. Your SSH connection is just a window looking in. Close the window, kick the door shut, the work carries on. You come back later and look in again.

I keep two habits that make it actually stick. First, named sessions, so I'm not guessing which of three numbered ones holds the thing I want:

tmux new -s migration
tmux attach -t migration

Second, I start anything that'll outlive a coffee break inside tmux by reflex, before I know whether it'll matter. The cost is nothing. The time it saves you, the one time the connection drops mid-job, pays for every other time you didn't need it.

There's a deep world of panes and scripting and status lines below this, and it's worth exploring eventually. But you don't need any of it to get the value. New session, do the work, detach without thinking about it. The tunnel can have my connection. It can't have my job.