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

tmux, or how i stopped losing my work to a dropped ssh

A short note on why tmux is the first thing I run on any remote box, and the two-line config that makes it stop fighting me.

A terminal with a tmux status bar across the bottom

For years my workflow on a remote box had a single point of failure: the SSH connection. The train goes through a tunnel, the wifi sulks, the laptop lid closes, and whatever long-running thing I was babysitting dies with the shell. I lost a four-hour migration to a flaky hotel network once. Once was enough.

tmux fixes this cleanly. The session lives on the server, not in your terminal. SSH in, run tmux, do your work. When the connection drops, the session keeps running. Reconnect and tmux attach, and you're exactly where you left off, scrollback and all. The first thing I now type on any new server is tmux. Not occasionally. Always.

The default keybindings are a little awkward, so two lines in ~/.tmux.conf earn their keep:

set -g mouse on
set -g history-limit 50000

Mouse on lets me scroll and resize panes like a normal human, and a bigger history means I stop losing the output I actually wanted. That's the whole setup. Everything else is gravy you can learn later.

If you run anything important over SSH and you're not in a multiplexer, you are one dropped connection away from a bad afternoon. Run tmux. That's the note.