Mosh – An Alternative To SSH

Mosh – An Alternative To SSH

Mosh, Mobile Shell, is a free Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes.

Mosh is a better replacement for SSH. It’s more robust and responsive, especially over Wi-Fi, cellular, and long-distance links. It is available almost for all GNU/Linux, FreeBSD, Solaris, Mac OS X and Android.

Why Mosh instead of SSH?

1. It always stays connected even your ip is changed.

2. Suppose if you lose internet connection or put your system in sleep mode and wake it up later, Mosh resumes the connection with your network machine when your network comes back.

3. You don’t need to be a superuser to install or run Mosh.

4. 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.

5. It runs inside your Terminal such as xterm, gnome-terminal, urxvt,, iTerm, emacs, screen, or tmux.

6. Unlike SSH Mosh doesn’t fill up network buffers, so Control-C always works to halt a runaway process. Suppose if you requested a 200MB file instead of 100MB, you can stop it immediately by pressing CTRL+C.

7. Mosh get rid of all network lag. If your remote connection is slow, it gives an instant response to typing, deleting, and line editing.

Install Mosh

On Ubuntu:

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

On Debian 6 or later:

$ sudo apt-get install mosh


You need to enable EPEL or RepoForge repository in order to install Mosh.

# yum install mosh

On Fedora 15 or later:

$ sudo yum install mosh

On OpenSUSE 12.3 or later:

$ sudo zypper in mosh

On Archlinux:

# pacman -S mosh

On FreeBSD:

# portmaster net/mosh


Just like SSH, you can connect to your remote system with command:

$ mosh root@

Sample Output:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

Here is my debian 7 wheezy server ip address.

Now you will able to connect to your remote system.

  • Zim

    You stated in the article, that it logs in over regular ssh on the remote end, but I got a closed session, because I did not have mosh server installed remotely.

    Don’t believe me:

    bash: mosh-server: command not found
    Connection to closed.
    /usr/bin/mosh: Did not find mosh server startup message.

    BTW client installed on Ubuntu 13.04, and remote server was running an openssh-server, that I often use for medial file transfer. The remote machine is running lubuntu 13.04.

    I will try installing on OpenSUSE a little bit later, and report results.

  • mike

    Hey, nice post, but doesn’t Fedora/CentOS/RHEL command look like:
    $ yum install mosh ?
    Or, eventually, is apt-get available for RHEL and its derivatives?

  • SK

    That was a typo. Thanks for the heads up.

  • SK

    I installed Mosh both on my Remote and local system, so i don’t have any issues that you’ve mentioned.