Essential SSH productivity tips

James Read
Feb 1 · 3 min read

If you’re like me, you spend your whole day in SSH sessions. Simply knowing how to save a few seconds here and there will add up to minutes and hours over time.

Photo by Soumil Kumar from Pexels

Use Mosh for bad and laggy connections — use SSH while roaming, with bad or laggy connections, most importantly, support for local echo (ie, you don’t want for the server to send keystrokes back to you).

I’ve been using Mosh with SSH for years.

It’s available in lots of formats too, including distribution repos for Fedora, Debian, even Chrome!

Use SSH keys instead of passwords

Not only is it more secure, it’s just faster. How many times do you type your password a day?

Windows 10 has OpenSSH now — Goodbye PuTTY!

One of the biggest benefits of this is that you don’t need to mess around converting SSH keys to a format that putty PuTTY can read. A native OpenSSH client on Windows means you can just use your keys as they are, and use the rest of the goodness of OpenSSH config.

PuTTY is just old, quirky, and hurts my eyes. Sorry.

SSH config — using a “host alias”

Most people don’t bother ever writing a SSH config. However, taking a few seconds to add a few simple statements can save you a LOT of time over a week or two.

I have a few servers which don’t have DNS records, or use ridiculous auto-generated usernames (cpanel, I’m looking at you). You can setup hosts with a simple alias and default settings, like usernames, and simply do“ssh cpanel”.

Host cpanel
HostName 92.304.190.22
User u123kjlk44

Also, I have some old BMC connections where I always login as ADMIN and need to enable support for old (bad) connection encryption;

Host hydra-*-bmc
Cipers +3des-cbc

Note; triple DES with cypher block chaining (3des-cbc) is hopelessly awful/insecure now-a-days, with much better options available. Just this hardware on these old machines just don’t support it.

You can set lots of defaults like this for hosts you access frequently.

Run a oneliner

You would be amazed at how many people don’t know that you can just run one line command and disconnect, simply like this;

user@host: ssh root@server poweroff


user@host: ssh root@server 'service httpd restart'

It just saves a few seconds here and there.

Use screen/tmux

Terminal multiplexers should be a standard tool in your toolkit if you’re using command line and SSH a lot. Screen is great as it’s in almost every single distribution, but it’s largely been replaced by tmux now-a-days. They both work using very similar keybindings (Ctrl+A vs Ctrl+B).

One popular use is to split the terminal up into multiple “windows”, however one of most useful benefits is being able to “save and restore” sessions — especially if your network disconnects. (hint, use tmux and mosh in tandem!)

Edit a file over SSH with vim+”rsync”

This one is actually new to me — found it at the link below. This should be a easy time saver to edit files over SSH with vim, by opening files with the rsync protocol;

user@host: vim rsync://server:/etc/hosts 

Once saved, the file is copied back to the server transparently. Nice one. :-)


Hopefully these SSH productivity tips will save you a few seconds here and there, which will add up to minutes and hours over time :-)

While doing a bit of extra research for this article and checking some things, I found a fantastic article here that includes many extra tips, including some advanced things that I didn’t know about!;

James Read’s Code, Containers and Cloud blog

Code inside containers that run on the cloud!

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store