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.

Install

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

Usage

Remote to machine

mosh user@remote-machine

Example

Run command on remote machine

mosh user@remote-machine -- remote-command

Example

mosh [email protected] -- tmux a

Run complicated command on remote machine

mosh user@remote-machine -- /bin/sh -c 'command1; command 2'

Example

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