← All posts

Mosh

Mosh: a terminal that survives Wi-Fi to cellular

How Mosh keeps TermRover connected as your phone changes networks, makes typing feel instant on slow links, and starts from a live SSH session.

MoshSSHMobile

Walk out of Wi-Fi range and your phone quietly switches to cellular. Most apps barely notice, but an SSH connection often does. The terminal freezes, the connection drops, and you have to find your way back to the right host and tmux session. With Mosh, the terminal simply carries on.

I recorded the switch below. TermRover is connected over Mosh, I turn off Wi-Fi, the phone moves to 5G, and the same terminal is still there and ready for input.

A live Mosh session surviving the move from Wi-Fi to 5G.

Small confession: I built most of TermRover before I knew Mosh existed. Once I understood what it solved, it felt made for a mobile terminal.

Your work stays put while the network moves

SSH runs over TCP. A TCP connection is tied to the network path it started on, so changing from Wi-Fi to cellular can break it. The shell or tmux session may still be alive on the server, but the connection from your phone is gone.

Mosh takes a different approach. It starts a small mosh-server process through SSH, then carries the terminal over UDP. When packets begin arriving from your phone’s new address, the session can continue there. A short dead zone, waking the phone from sleep, or moving between Wi-Fi and cellular no longer needs a reconnect ceremony.

This does not replace tmux. They solve different parts of the problem: tmux keeps the work alive on the host, while Mosh keeps the route from your phone to that work resilient. Together they are a particularly good fit for checking long-running coding agents while moving around.

Predictive typing is optimistic UI for a terminal

Network switching is the obvious benefit, but Mosh also feels much better on a slow connection. Your keystrokes appear immediately instead of waiting for a round trip to the server.

I am originally a frontend developer, and the closest analogy is an optimistic update. When someone taps a favourite button, a frontend can update the interface immediately, send the request in the background, then reconcile with the server’s response. The server remains the source of truth, but the interface does not have to feel one network round trip behind every action.

Mosh applies a similar idea to terminal echo. It can predict what your typing should look like locally, show it straight away, and reconcile the screen when the server catches up. It is not running your command on the phone or guessing the result. The remote terminal is still authoritative. It just removes that sticky feeling where each character waits on a distant server before appearing.

On a good connection this is subtle. On a high-latency cellular link, it is the difference between typing naturally and fighting the terminal.

Start with SSH, then switch the live session

I did not want Mosh to become a second connection type that you had to understand before opening a terminal. In TermRover, you can start with the familiar SSH connection. When you want Mosh, tap the SSH badge and choose Mosh.

TermRover brings up Mosh in the same live tab, while your terminal and tmux context stay in place. It does not close the working SSH terminal until the Mosh path has answered, so a failed setup does not throw you out of the session you already have.

Once it works, you can use Mosh just for that tab or make it the default for that host. You can also switch back to SSH when you need to.

One server-side step, guided from the app

Mosh does need mosh-server installed on the remote host. That is the one piece of setup SSH users may not already have.

If TermRover cannot find it, the app keeps your SSH connection open and guides you through the install. It detects the host’s package manager, prepares the appropriate command in the visible terminal, and leaves you in control of running it. After that, retry the switch and continue in the same place.

The server also needs to accept Mosh’s UDP traffic, normally on ports 60000 to 61000. If a firewall, VPN, public Wi-Fi network, or mobile carrier blocks that path, TermRover explains what to check and lets you stay on SSH.

You do not need to understand the protocol first. Start with SSH, let TermRover check the host, and follow the prompts if anything is missing. The How to Mosh guide shows the whole flow.

A mobile terminal should expect the network to move

Laptops mostly sit on one connection. Phones do not. They leave buildings, cross dead zones, sleep in pockets, and move between Wi-Fi and cellular all day.

That is why Mosh support matters to me. It is not just another connection option. It makes the terminal behave like it belongs on a phone: the session stays with you when the network changes, and typing still feels immediate when the network is slow.