Quick Links

Smartphones these days pack more than enough power to run lightweight SSH clients, which enables you to connect to your VPS and fix important problems when you don't have access to a laptop and WiFi.

Smartphone SSH Clients

Under the hood, all mobile SSH clients really just let you do the same thing: SSH into a server. What sets them apart is how they improve upon the experience of using a terminal on a mobile device. Your keyboard is limited on mobile; it's designed around texting and typing short messages, not coding. Even having to type "

        -
    

" and "

        /
    

" is hard, requiring three button presses on a standard iOS keyboard.

Good mobile SSH clients make this process easier. For example, Termius is a very popular free SSH client for iOS and Android. The interface of the terminal itself has a regular keyboard, but above it contains controls that would be unwieldy to type on a mobile keyboard. You're often using the

        ctrl
    

 modifier key, so Termius has a button dedicated to it alongside

        esc
    

. Commands often make heavy use of dashes and forward slashes, so those have dedicated keys as well, saving you a button press.

Interface of a Termius terminal showing the keyboard.
A Termius terminal.

Outside the terminal, the rest of the interface is very usable; creating a new SSH key was easy, and gave me the option to send it to my Macbook to add to the server's

        authorized_keys
    

. You can also import keys, which would be a seamless solution and enable your phone to act as your desktop. Connecting to servers is easy, and you can save them to a list for easy future access.

Termius is free for iOS and Android but lacks some features like tabs, SSH agent forwarding, and SFTP to the premium version, which is subscription based at $8 a month.

Prompt is a premium iOS client that packs a lot of useful features. It has the same quick action bar design as Termius, but is swappable depending on the application.

A Prompt terminal with keyboard.
A sample list of Prompt's global clips (commonly used global commands).

It also supports saving your most frequently used commands to Global Clips that you can paste in, saving you from typing them in multiple times. It costs $15, but it's a one-time fee and includes every premium feature out of the box.

Mosh

Mosh is a replacement for SSH that uses UDP, and is built specifically for mobile users. Traditional SSH waits for the server to respond before showing your keystrokes, which can be disorienting on high latency connections. While 4G has a good average latency of around 50ms, if your connection drops down to 3G your latency could spike to over 300ms. Mosh is able to work around this limitation, and brings down key response time significantly:

Graph of Mosh's keystroke response time percentage,

In addition, Mosh is able to keep alive a terminal connection even when internet connection cuts out, which can happen frequently on a mobile. You should use tmux or

        screen
    

 anyway, but having Mosh support it out of the box is a nice touch.

Mosh is supported as an option in Termius and is the primary option for Blink. Unfortunately, Mosh's GPLv3 license prevents it from being included in Prompt, which is not open source.

Always Use tmux or screen for a Seamless Experience

After you establish an SSH connection, you should connect to

        screen
    

 or tmux. tmux is a terminal multiplexer for running multiple terminal sessions in a single window, but it also enables you to disconnect from a session and leave it running on the server. You can connect to it from anywhere, so you can start something from your desktop and pick it up on your phone.

tmux may be installed already, but if not you can install it from your distro's package manager:

sudo apt-get install tmux

Then, you can create a new session with a name:

tmux new -s session

You'll see a new status bar along the bottom, which lets you know you're operating within tmux. If you want to detach from the session, you can use:

tmux detach

Or simply press Control+B followed by the D key, but that may be unwieldy to press with a mobile terminal. You can also use the exit command to kill the session altogether.

Your session continues to run on the server; your currently running programs, command history, and everything else stay running in the background, even when you're not online.

To connect to the session again, use:

tmux a -t session

In some SSH clients like Prompt, you can set a startup command to run when you connect to it. So, if you have a tmux session you're always connecting to, use the startup command to auto-attach it.

tmux has a lot of other features, so read our guide to using it to learn more.