Mosh is a mobile shell that provides better connectivity over unreliable networks. Here's how I install and configure it for better user experience.
Installation
To install mosh-server on a remote machine:
sudo wget -O /usr/local/bin/mosh-server \
https://github.com/blinksh/mosh-static-multiarch/releases/download/1.4.0%2Bblink-17.3.0/mosh-server-1.4.0+blink-17.3.0-linux-amd64 \
&& sudo chmod +x /usr/local/bin/mosh-serverConfiguration for better UX
For better user experience, I configure mosh with prediction settings. In fish shell:
set -Ux MOSH_PREDICTION_DISPLAY always
set -Ux MOSH_PREDICTION_OVERWRITE yesThese settings:
MOSH_PREDICTION_DISPLAY always- Always show local echo predictionsMOSH_PREDICTION_OVERWRITE yes- Overwrite existing text instead of inserting before it
From the man page, the --predict option controls speculative local echo:
adaptive(default) - Show predictions on slower links and smooth out network glitchesalways- Always show predictions when confidentnever- Never show predictions
The --predict-overwrite option makes predictions overwrite existing text instead of inserting before it, which provides smoother typing experience.