Mosh the Mobile Shell

- 1 min read

Do you have a low speed or spotty network connection

If you have ever tried using ssh from a device with a spotty Wi-Fi connection, you know that the experience can range from less than ideal to downright infuriating.

Sometimes keystrokes are not sent, the latency can be brutal, and your connection may timeout.

Mosh to the rescue :metal:

Mosh is the mobile shell that alleviates the responsiveness problems that plague ssh. Instead of using TCP, it uses UDP so your connection can persist across network changes or putting your laptop to sleep.

Penguins

Image by enriquelopezgarre from Pixabay

The Problem

I have been experiencing a hard freeze on my first gen Ryzen 1700x system which has been very annoying. This is the kind of freeze where I can’t even drop into a virtual terminal or do an Alt-SysRq.

This happens on both my Debian 10 and Ubuntu 19.04 installs running kernel versions 4.19 and 5.0.0 respectively. It would happen almost randomly but prominently when my CPU was idle and not doing much.

There are a number really awesome tools that can be used to view and validate JSON files right from the command line. As it turns out, one such tool is built right into Python as the json.tool module. Usage is as follows:

python -m json.tool [-h] [--sort-keys] [infile] [outfile]

If a single argument is given, it will validate the file and (pretty) print it to stdout.


This is all good and dandy, but what if I want to edit this JSON file now. I could always write it to an output file and edit that, but that’s just extra steps to take. To bring this trick to another level of handiness, I added this mapping to my vimrc.

What is rsync

We can run the whatis rsync command to get a short description without opening the man page

rsync (1)            - a fast, versatile, remote (and local) file-copying tool

Rsync is the ultimate tool for copying files and is loved by many people. It offers many advantages over traditional methods like SCP or FTP which are linear file transfer tools. Rsync checks the delta of files between the source and the destination and only transfers the difference. Additionally it allows an option for easy compression of files before they are sent over the network.