TLDR; I share what CLI tools I use on a daily basis on my terminal to improve my productivity.
First things first, the command line is awesome. It makes me so much more productive by not having to move my hands to the mouse - I don’t have words for it.
This blog post introduces a few tools I use on a daily base, that either replace some more well known and existing tools or a just super useful in general.
If you want to test out all the tools, just run these two lines on osx, they should install all the tools listed here
brew install byobu zsh lsd bat fd ripgrep nvm \
neovim restic topgrade direnv exiftool jq \
websocat mitmproxy osquery prettyping htop \
weechat wifi-password coreutils
brew cask install alacritty
brew tap caskroom/fonts
brew cask install font-hack-nerd-font
alacritty + byobu
The standard terminal emulator under osx seems to be iterm2, which has a great set of features, is easy to configure via its UI. However running htop in a terminal already eats a lot of CPU on my macbook (especially on updates), so I figured it might make sense to switch. Also iterm2 required more memory than alacritty in my tests.
I looked at kitty, but finally settled with alacritty. Alacritty has fewer features that I have been relying on with iterm2 and kitty, most notably the usage of tabs and splits and when I first looked at it, it also lacked scrollback, but that has been added.
So, how can we add back that functionality? By using byobu! Byobu is a terminal multiplexer with great default keybindings for pretty much everything like tabs/spaces management, mouse support and a small status bar. It’s using either screen or tmux as a backend window manager.
One of the best features is just hitting
shift+f1 to get all the help
you need. Also there is a great youtube video on the byobu homepage, so go
check it out.
I’m still in the process of switching so I keep changing between byobu and iTerm2 every now and then. One unfortunate thing is the excellent use of f-keys, which is easy with a regular keyboard, but horrible with touch bar under osx.
zsh - my favorite shell
I do not think there is a super big difference using either a recent bash or zsh, but oh-my-zsh makes all the difference to me. oh-my-zsh is an awesome configuration framework for zsh. It is pretty big nowadays, but you can pick what you need and be good with it.
I used the
agnoster theme, but we will get to alternatives later.
Another interesting feature of oh-my-zsh is the endless amount of plugins, be keyboard extensions or other functionality. I am not using a lot of them, like the git or warp directory ones, but by far my favorite is the zsh autosuggestions one.
If a suggestion is made, you can hit
ctrl+e to finish it for you. Super useful
and no need to through your history.
Configure your prompt, use GBT
We all love our fancy prompts with lots of colors, a mechanism to show for version control changes plus a nice reduction of long paths, right?
Every shell nowadays features this, be it bash, zsh or the fish shell - where I saw fancy prompts for the first time. However I was always annoyed that I had some wait time, when being in a git repository until my prompt was displayed, when using zsh and oh-my-zsh. Luckily I found gbt, a highly configurable prompt builder for bash and zsh, written in Go and thus being super fast.
This is my setup
export GBT_CARS='Status, Dir, Git, Sign'
export GBT_CAR_SIGN_FORMAT=' '
resulting in a prompt like
Common tools replacements
This section is about replacing a couple of super common command line tools, that are used everyday, yet have very powerful and easier to use replacements.
lsd instead of
ls has not changed a lot in decades after it got colored output. However,
terminals have, being able to display fancy icons. In order to show an icon
together with a file in order to represent the file type a small ruby tool
called colorls exists since a
long time. However I found it to be pretty slow and was waiting for someone
to write a replacement in a compiled language. Finally there is a great
alternative called lsd which is doing
that and some more. I used exa before that,
but I find
lsd much nicer.
See the default output with relative times, and nice color separation, plus icons for file types.
bat instead of
bat is another great example of a small
daily used tool being improved. It’s an improved cat, with a syntax
highlighter and line count displayed by default falling back to cat
behavior when used with pipes. You can also combine it with
tail -f to
have continuous syntax highlighting. Also, it has support for themes for the
fd instead of
fd is like
find, but better. Again,
colorized output, taking
.gitignore into account, parallel execution and
therefore also faster.
rg instead of
And the last of my common shell tool replacements.
grep earned a few more
features over the last years like colorized output. However there are still
reasons to switch to rg aka.
ripgrep, also compared to alternatives like
ack and the silver searcher
You can limit by file types, again
.gitignore is taken into account (when
working on a big code base, this is invaluable, thus many of the tools
presented here take this into account), and being mostly compatible with
One last piece of advice, always make sure to install the
package, even under osx, this way of have access to the most common gnu
utils on the command line, which might come in handy when writing shell
scripts that need to be compatible.
Also, it’s nice to see rust replacing those old tools on the command line step by step.
prettyping instead of
prettyping is basically a
wrapper around the
ping output with some nice formatting to indicate the
latency of a ping, so that it’s easier to see changes over time. The picture
below shows some problem in my local guest network that I have not been able
to track down yet, very nice visualized.
Version your programming languages
Whatever programming language you are writing code in, make sure you can switch the runtime version of your programming language anytime as fast as possible. When debugging customer issues or even because you want to make sure your tool is working everywhere, this will be a live safer.
I am regularly using nvm for node and sdk for java, kotlin and micronaut. I am missing a good version manager for crystal, anyenv/crenv did not work properly when tested some time ago. I do not do any ruby, so there is no need for rvm.
One thing to pay attention to is, that you usually but some piece of code in
.bashrc/.zshrc and that slows down your start up time. There are some
nvm to only get called when
nvm are actually typed
in by the user - this is something you should look out for and play around
with, otherwise initializing lazily might make sense.
I never used a lot of vim plugins, but I wanted to develop crystal code within vim and enjoy syntax completion, so I installed neovim for that - which indeed is super interesting. If you have been a long time vim user, I highly recommend to take a look at neovim.
A lot of the internal design has been rethought, a fair share of cruft removed and it is more of a community driven project and on top of that, it makes it super simple to have UIs on top of neovim by having proper boundaries.
Easy upgrades, topgrade
Upgrades, always forgotten. When did you upgrade oh-my-zsh the last time, do you remember? Well, you do not have to, when you use topgrade. Topgrade upgrades a bunch of things, with brew and osx system upgrades already being a great helper, but having two dozen more upgrade mechanisms for certain tools is nice to know.
Nasty topic, I know. I do not want to use time machine, as this forces you to have another osx system available if you need to restore. Also I would like to be able to run this on several operating systems and from the command line . So I opted for restic, allowing you to back up to disk or into the cloud. The latter has finally become an option in 2019 in Germany as my internet upstream speed allows for this.
In general, all restic needs is a configuration file (including directories to exclude for example, like downloaded dependencies), an endpoint and all you need to provide is a password for every operation, as the repository is encrypted.
I do not know of any better backup tool. And yes, I restored already :-)
These just get a small mention, but they are nonetheless super useful to me, again some of them just supersede or extend an existing useful tool.
When entering a directory,
direnv reads the
.envrc file and executes it
if trusted previously. Also
direnv unloads when leaving the directory.
This is already quite an old tool, but still a nice replacement for top. Easier to check load with multiple CPUs and a couple of easy to use administrative functions.
A small CLI tool to I mainly use to clean exif data from images, i.e. the location and date photos were taken.
The easiest call is to remove all metadata via
exiftool -all= img.jpg.
I am dealing with a lot of JSON. The swiss army knife for parsing and
mutating JSON is definitely
jq. It is super powerful and I may have only
mastered one percent of its actual functionality, and still I love it. You
can modify JSON, execute calculations, or just filter down huge responses
(that can happen often in sizable Elasticsearch cluster, in which context I
am using this tool the most), pretty much anything you want.
Also, colorizing is supported, which again is super useful for human parsing. I have always set this alias an alias for prettyprinting, so I can do
pp='jq -C . | less -FX'
cat foo.json | pp
A client for websocket communication, again written in Rust. Very useful for demos, when you need to consume a websocket stream like this one.
An interactive HTTPS proxy, quite useful for debugging. Another proxy I use for testing is tinyproxy.
This turns operating system and device stats into objects that can be queried via SQL, even things like open file handles or TCP connections. It’s a common admin tool nowadays, so common it even got its own conference.
IRC is still alive after all! However I have a hard time finding proper clients that are still in development. weechat was one of the few that looked nice and are still in development. weechat also features a slack plugin, however that was not super usable. weechat is pretty configurable, but most of all features really nice keyboard shortcuts.
Sometimes all you need to know is the current wifi password, as you might want to share it with your neighbor. This is all the tiny tool is doing.
Non cli apps
I know, this is a CLI post, but there are few apps, which I really need to survive under osx. If you know proper and awesome alternatives for the command line please let me know!
I use simplenote for note taking, sharing across devices and persons (like our grocery list). The apps feels sluggish everynow and then and there is no proper integration for storing documents (images, pdfs), but it is good enough for now.
My current browser is Brave.
Whenever I mistype on the touchbar, haptickey will give some feedback. The touchbar is one of the worst inventions for keyboard heavy people and I am very happy with my regular keyboard, when not travelling.
I use sloth for checking open sockets and file handles.
And lastly I use menubar-stats to monitor load, network traffic and available memory.
So, what am I really missing? I usually check what eats a lot of memory and then check if there is a CLI tool available on osx. Two excellent candidates to me are a spotify client and a slack client. For spotify I am not aware any such tool exists, where as for slack there is the weechat extension as well as slack-term and sclack, which I have not yet tested properly.