Get started with Mosh

What is Mosh

Mosh is a replacement for interactive SSH terminals.

Mosh doesn’t listen on network ports or authenticate users. The mosh client logs in to the server via SSH, and users present the same credentials (e.g., password, public key) as before. Then Mosh runs the mosh-server remotely and connects to it over UDP.

Why I use it

It doesn’t end session when connection is lost.


You need to install mosh on both client and server machine.


Remote to machine


Run command on remote machine

mosh [email protected] -- remote-command


mosh [email protected] -- tmux a

Run complicated command on remote machine

mosh [email protected] -- /bin/sh -c 'command1; command 2'


mosh [email protected] -- /bin/sh -c 'if [ -z "$TMUX" ]; then tmux a || tmux new -s default; fi'
mosh  ssh 

See also

comments powered by Disqus