My Quick Notes

Ain't Nobody Got Time to Read

January 20, 2020

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

mosh kimtinh@192.168.1.3

Run command on remote machine

mosh user@remote-machine -- remote-command

Example

mosh kimtinh@192.168.1.3 -- tmux a

Run complicated command on remote machine

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

Example

mosh kimtinh@192.168.1.3 -- /bin/sh -c 'if [ -z "$TMUX" ]; then tmux a || tmux new -s default; fi'
PreviousNGINX Basic Authentication
NextUseful Firefox Add-ons - History AutoDelete

Comments