In the world of remote computing, sometimes a simple SSH connection just isn’t enough. Network connectivity issues, long-distance latency, and unstable connections can all make it difficult to work effectively on remote machines. This is where Mosh comes in. Mosh is a remote terminal application that is designed to work over intermittent connections, and it offers a number of features that can make remote work much easier and more efficient.
What is Mosh?
Mosh is short for “mobile shell.” It is an open-source remote terminal application that provides a more robust and stable connection than SSH. While SSH connections are generally reliable, they can be vulnerable to network disruptions, leading to dropped connections or delayed output. Mosh was designed to address these issues by using a combination of predictive input and synchronization protocols that allow for a more responsive and stable terminal experience.
One of the key features of Mosh is that it is designed to be resilient to network disruptions. If you lose your connection, you can simply reconnect and Mosh will pick up where you left off. This is in contrast to SSH, which typically requires you to start over with a new connection. Mosh also provides predictive input, which means that it can predict what you are typing and display it immediately, rather than waiting for the server to echo your keystrokes.
Mosh vs SSH
While SSH is a widely used remote terminal application, there are some important differences between SSH and Mosh. Some of the key differences include:
Resilience to network disruptions: Mosh is designed to be more resilient to network disruptions, which can be especially helpful when working over unreliable networks.
Predictive input: Mosh provides predictive input, which allows you to start typing immediately and see the results immediately, rather than waiting for the server to echo your keystrokes.
Better support for Unicode and non-ASCII characters: Mosh provides better support for Unicode and non-ASCII characters than SSH, which can be important if you are working with international languages or character sets.
Improved performance: Mosh can be faster than SSH in some situations, especially if you are working over a slow or high-latency connection.
How to use Mosh
Using Mosh is relatively straightforward, but there are a few things you need to know in order to get started. First, you will need to install the Mosh client on your local machine and the Mosh server on the remote machine you want to connect to. Once you have installed Mosh, you can connect to a remote machine by running the following command:
mosh username@hostname
This will create a new Mosh session on the remote machine and connect you to it. Once you are connected, you can use the terminal just like you would with SSH.
Mosh also provides a number of options that you can use to customize your connection. For example, you can specify the port number to use with the -p
option, or you can disable predictive input with the --no-predict
option. To see a full list of available options, you can run the mosh --help
command.
Conclusion
Mosh is a powerful remote terminal application that can be a great alternative to SSH in certain situations. Its resilience to network disruptions, predictive input, and improved support for Unicode and non-ASCII characters make it a great choice for remote work, especially when working over unreliable networks or long distances. If you are a system administrator, developer, or remote worker, give Mosh a try and see how it can help you work more efficiently and effectively.