Mosh – The New SSH!

Mosh (Mobile Shell) is a terminal application similar to SSH but it’s more robust, responsive and of course it’s mobile i.e it allows roaming (you will be connected to your server even the network/IP Address changes).

Mosh is a free software (available under GPL, hosted at GitHub) available for GNU/Linux, FreeBSD and Mac OS X. So you might be thinking that it’s a good replacement for ssh protocol – you’re right, in fact it is. So next time you login to your remote server then don’t forget to give it a try!


Why should you try Mosh (over SSH) ?

  • It’s faster (no network lag)
  • more robust
  • no special privileges (superuser/root) is required
  • designed from scratch for Unicode
  • same login method (using public key or password)

How to Install Mosh in Ubuntu

Ubuntu 12.04

In Ubuntu 12.04 LTS – it’s already there in the official package repository, just execute –

sudo apt-get install mosh


Older versions of Ubuntu i.e 11.10/…

$ sudo add-apt-repository ppa:keithw/mosh
$ sudo apt-get update
$ sudo apt-get install mosh


Recommended Reading(s)

  • anon12b

    I think you have a somewhat confused view of what this application is and is not.

    Let us take the bullet points: “no network lag” – Mosh is actually designed to work when there *IS* significant network “lag,” that is the whole point; “more robust” – in what way?  This needs clarification, but I presume you mean to random network drop out or lag which is correct to an extent; “no special privileges is[sic] required” – apart from SSH running as root to create a login session for you in the first place; “designed from scratch for Unicode” – not relevant at all, in terms of the protocol there is an agnosticism to this aspect; “same login method” – because you are using SSH to login.

    The real advantages to, or reasons you may consider, Mosh include: works better through poor connections than SSH; roaming (as you mentioned) because TCP is not used; protects stupid terminals from incorrectly interpreting UTF8.

    The disadvantages are mainly that is nowhere near as tested as SSH in terms of protocol or implementation.  The author clearly acknowledges this in the FAQ.  You may consider it a disadvantage that you have to use SSH still, but there is good reason not to duplicate what SSH is really good at.  Further, it is not beyond imagination that Mosh will at some point be able to run an authentication service.

  • anon12b

    Just to clarify, I just realised that you may think the local echoing (and output prediction) are no network lag.  This is really not the case, it is designed to provide accurate visual feedback.  The network lag is still there, and you will eventually have it catch up with you.  It is a quality of life feature, that can be quite useful if typing sentences on a remote connection (mail/IRC/etc).  Not as useful if you are using completion (such as tab completion), as you have to wait for the result.