gitmyhub

mosh

C++ ★ 14k updated 3mo ago

Mobile Shell

Mosh is a remote terminal application like SSH that stays connected when you switch networks, lose Wi-Fi, or put your laptop to sleep, it roams automatically and shows instant typing feedback even on laggy or high-latency connections.

C++setup: moderatecomplexity 3/5

Mosh is a remote terminal application, similar in purpose to SSH: it lets you connect to another computer over the internet and run commands on it. The key difference is how it handles unstable or changing network conditions. Where a standard SSH session drops the moment you lose your Wi-Fi or wake your laptop from sleep, Mosh keeps the session alive and picks up where you left off once connectivity returns.

When you switch networks, such as moving from a coffee shop's Wi-Fi to your phone's cellular data, Mosh detects your new IP address automatically and continues the session without any manual reconnection. This roaming behavior is built into the protocol itself.

Mosh also handles slow or high-latency connections better than SSH. It runs a local prediction model that guesses how each keystroke will appear on screen before the server confirms it, then immediately shows that prediction to you. The predicted characters are underlined until the server responds. For most typing and arrow-key navigation, the result is a terminal that feels responsive even when your connection is lagging. Full-screen applications like text editors and IRC clients work correctly with this system.

Under the hood, Mosh uses SSH only to establish the initial connection and verify your identity. After that, the session moves to UDP, which lets it tolerate dropped packets and changing addresses. By default, it picks a port between 60000 and 61000. Your firewall needs to allow UDP traffic on that range for Mosh to function.

There are some things Mosh does not do: it does not support X forwarding, port forwarding, or any of the non-interactive modes that SSH handles. It requires a UTF-8 terminal environment and needs its server binary installed on the remote host alongside the client binary on your machine.

Where it fits