2 ms·
No. Mosh handles automatic reconnection (and a bunch of other stuff, like predictive typing so you don't notice flickering or slow connections, and performance
by zbentley 9y ago
No. Mosh handles automatic reconnection (and a bunch of other stuff, like predictive typing so you don't notice flickering or slow connections, and performance improvements); tmux runs a persistent process on the remote side that preserves the state of your sessions.
Using mosh + tmux allows you to have both a) state persisted on the remote side, and b) automatic reconnects if your internet drops, or if you change connections. It's a very good combination, if you can handle some of the drawbacks of mosh (no in-terminal scrolling, mostly, but you can outsource that to tmux as well at the cost of a little lag).
A good additional piece of the puzzle is tmux-resurrect [1], which saves and automatically restores a lot of your tmux state to the filesystem so it's proof against power loss and system restarts/relogins. It persists window arrangements and similar, though it obviously can't save everything--the state of programs that were open can't be programmatically preserved (though that's getting closer and closer to seamless with the advent of things like CRIU).
The combination of mosh + tmux + tmux-resurrect is a very popular one and creates a very resilient system for "don't make me think; just log me in to my usual environment"-type systems, or environments where internet connectivity is spotty or the tmux server environment is unreliable or prone to rebooting.
[1] https://github.com/tmux-plugins/tmux-resurrect https://github.com/tmux-plugins/tmux-resurrect