3 Tools I Use On Every Server
The first things I install when I start a fun new adventure.
I've setup more servers than I care to remember. Each time I setup a server, I always go through the same steps of configuring ssh, opening and closing ports, setting up a firewall, and so on. Despite the advancements in DevOps over the past few years, I've come to the conclusion that these steps are unavoidable, the best thing to do is make my stay on the server a bit more enjoyable.
This isn't too hard, assuming a decent familiarity with the command line. These are the three tools I use on every server to make my ride more comfortable, and hopefully they'll make your ride a bit more comfortable too.
1. Mosh
"Mosh" stands for the "mobile shell", but it might as well stand for "magical shell" because it is really rather extraordinary. Mosh will use ssh to authenticate you into the server, but then it uses it's own protocol to keep the session alive even if you drop the connection.
I have literally moshed into a server in one airport, flown across the country, and then resumed the session in another airport. This is especially great for remote workers such as myself that tend to hop between coffee shops and would like to pick up where they left off at the last café.
Plus, saying you're moshed into the server is way cooler than saying you are es es aiched in.
Seriously, mosh is wonderful. Learn how to install and configure mosh here.
2. Tmux
If you regularly have multiple terminals open while working, but you've never tried tmux, then this is your wake up call. Give it a few hours of your time, learn the basics, and you won't regret it.
Simply put, tmux ("terminal multiplexer") allows you to run multiple terminals inside a single terminal.
My tmux use-case is very simple. On my home server I have a tmux session always
running. I mosh in to the server, then do tmux attach
and I can join the tmux
session where I left off. I usually have 4-5 windows open in tmux for running
tests on my work code, managing a few support services (e.g. an ELK stack) for
said work code, mucking around in directories, and so on.
With the combination of mosh and tmux, I can be moshed into my home server, start running the test suite while at my home office, close my laptop and bike to the coffee shop, then open up and read the test results without without skipping a beat. This works perfectly because the time it takes to bike to coffee is about the same time it takes to compile and test all the code! (Ha!)
There are many guides online for installing, configuring, and using tmux, so I'll leave it to you to find one you like. Personally, I'm always forgetting tmux shortcuts, so the DuckDuckGo cheat sheet comes in handy quite often. I also think this tmux config is a nice starting point.
3. Htop
I can never remember how to read all the stuff that top gives me, but in htop the information is organized and presented so well as to be obvious. Htop is simply a better top.
It's a small program and is available in every package manager that I've had the
pleasure to use; installing htop is usually the first thing I do when I'm on a
new server. sudo apt install htop
Boom. Done. Learn more at the official htop
homepage
4. Bonus!
I would be remiss if I didn't mention ranger. Although it's pretty well-known by now, and it's not a necessity, it made this list because it is certainly a nice-to-have.
If you have more awesome tools to share, send me an email at ben@bsima.me, I would love to learn what you have to teach.