In looking for a better SSH client on Android, I came across JuiceSSH – and while setting it up I noticed there was an option for Mosh that was selectable instead of SSH. After investigating a bit, it turns out that Mosh stands for Mobile Shell, and while it’s optimized for mobile connections, it also works really well for laptop connections.
All of the technical details can be found on the Mosh site, but as point of demonstration, my laptop usage is very mobile. I will go from an office to a mobile hotspot, to home on a VPN, etc; all without losing the Mosh shell. The reason all these network changes work is because it leverages the connectionless UDP instead of TCP, which would break the connection when networks changed.
This means I can always have a shell up at the ready on my terminal, and it’s resilient to changing/poor network conditions. For phone/mobile, it’s just as convenient.
Getting setup with it is fairly easy – just install the Mosh client on your laptop or an app supporting Mosh on your mobile, and then also install the Mosh server on your server. It doesn’t need to run with elevated privileges, meaning you can install it as a regular user (no need for a system wide install / daemon-mode), which is great if that’s your situation.
The initial network setup is done over SSH, and then it hands off to Mosh, so you can still use your public keys for authentication, etc.