Mosh (mobile shell) is a remote terminal application that supports intermittent connectivity. It handles network switching and roaming better than SSH, making it ideal for mobile and unreliable connections.
📑 Table of Contents
Key Features
- Roaming: Survives network changes
- Instant Response: Local echo for typing
- UDP Based: More resilient than TCP
- SSH Authentication: Uses SSH for initial connection
- State Synchronization: Recovers from disconnects
Installation
Install Mosh on Ubuntu:
sudo apt update
sudo apt install mosh
Usage Examples
Using Mosh:
# Connect to remote host
mosh user@hostname
# Specify SSH port
mosh --ssh="ssh -p 2222" user@hostname
# Use specific mosh server port
mosh -p 60001 user@hostname
# Predict mode (less latency)
mosh --predict=always user@hostname
Benefits
Mosh provides reliable terminal sessions over unstable connections. Its intelligent local echo and automatic reconnection make remote work seamless.
Was this article helpful?