Share: Facebook icon - Twitter icon - LinkedIn icon

Cool command line tools

Published Sun Aug 30 2020

Tags: linux cli

There are a lot of cool CLIs in Unix and GNU/Linux based operating systems to check out. Here we will look at some very useful ones, and one very fun one at the end. None of them will be standard tools that is already installed on your Mac OS X or GNU/Linux setup by default! This article would be very boring if I just listed some tools, so I include some screenshots :)


You have probably used cat, which can be a useful tool for viewing the content of files (but mostly for use in piping them to other programs!). Think of bat as a sort of cat, less and syntax highlighter hybrid. If that sounds awesome, it is because it is! You may wonder how it is a hybrid between cat and less? Is it like cat or is it like less?!? It can't be both, can it? Yes, it can. If the file is too big for your screen (terminal window), it will work more like less and let you navigate the contents. If it is just big enough, the content will just be printed to your terminal. Let's see some screenshots!

Let's see the behavior when viewing a file that fits our terminal window (bat hello.go):

This is just showing hello world code in Golang, so nothing interesting. What we see is the similarities with cat!

Let's take a look at the similarities with less (bat ID_VH.C):

Slightly more interesting example, as this is part of the Wolfenstein 3D source code. This exact code is the "Fizzle Fade" code which clears the screen pixel by pixel using a Linear Feedback Shift Register (maybe a topic for a future article? ;) ). Back to the topic at hand… Here we can see that the interface is slightly different, more like less. It navigates like less too!

Did I mentioned that like cat, you can open multiple files at the same time? It will just print all listings. Running bat hello* gives us:

Just the Hello World Exercism task with Prolog. Did it as part of the exercises for Prolog earlier this year. The syntax highlighting here is not awesome, but we see clearly bat's behavior with multiple files as input.

jq and yq - JSON and YAML querying

JSON and YAML are very common dataformats these days. If you use a REST API with curl, you might want to parse the data to view the parts you are interested in. If you use something like Spring or Kubernetes, you might want to look at parts of your YAML properties. These types of problems can easily be solved by jq (JSON) and yq (yaml). Viewing in this sense can also mean processing the data to formats you want them in, so they are more than simple viewers! While they have a different set of commands, I think they are similar enough to be mentioned in the same section.

The best resources for these tools are off course the man pages, but I have found a more visual guide for jq to be of great use as well. For yq, I have found the official documentation to be the best resource. Because these are programs with a bit more advanced syntax (with a need for some good examples!), I will not give screenshots here. I urge you to check out the aforementioned guides and documentation if you think these tools sound interesting.

While powerful, I must say that there are long times between my usage of them, so documentation to freshen up sure comes in handy.

mc - Midnight Commander

Do you miss file managers like Norton Commander from the DOS era? Then you might be pleased to know that Midnight Commander exists! It works exactly the same as Norton Commander used to, but with some additional features. Not my most used program, but comes in handy sometimes.

(here you get a sneak peek on how this site is created :) Jekyll + Github pages. There is also the blogging from Org mode in Emacs part which I plan to cover in a future article.)


Let's finish with a less useful, but fun command line tool. lolcat is probably not something you will have much use for, but it will spice up your terminal with rainbow colors. You can use it like you use cat, but I think the most fun use of it is to pipe some fun input to it.

You can probably make a cool welcome-message in your shell with it!

Other posts that might interest you: