Querying CSV with SQL

Excel is not the only tool available when it comes working with CSV files.  I have previously mentioned TextQL (here).  Yesterday, I tried another tool, called “q”.  But since searching for “q” is not very effective, it’s also known “q text as data“.

For those using Fedora, you can install it by simply running “dnf install q-text-as-data“.   Here’s an example of how it works:

$ q-text-as-data -H -d ',' "SELECT COUNT(DISTINCT(Project)) FROM deploy.csv"
95

In the above example, I’m querying the deploy.csv file, which is in the current folder. q supports both command and tab separated values, so I’m helping it out with the “-d ‘,’” parameter, saying that this particular one is a CSV. “-H” tells q that the first row in this file is used for headers. CSV files with headers are more convenient, as you can use headers as column names, instead of numerical indexes.

SSH via bastion host

A while back I wrote this blog post on the subject of using SSH via bastion hosts.  If you are into this sort of thing, have a look at this blog post by my brother.  He is providing a few more explanations and clarifications, as well as covers a tricky to troubleshoot case with non-default location of your SSH configuration files and keys.

SystemD strikes again : Unit X.mount is bound to inactive unit

My brother is blogging about a really weird issue we had today.  Apparently, the old school approach of working with disk volumes, and mounting them is not enough anymore.  These days, systemd is responsible for part of that workflow and it can bite you in the behind if you are not careful.

Solution: run “systemctl daemon-reload” whenever you edit /etc/fstab.

Run boy run! This world is not made for you …

 

jq and jo – handy CLI tools for working with JSON

Here are a couple of really useful command-line tools for anybody working with JSON.  The first one is jq, which is a somewhat wider known JSON processor.  Here’s a nice tutorial with many examples of how this tool is useful.  The second one, is jo – a command-line tool for easier creation of JSON output.

htop explained

htop explained” is a very detailed guide into the htop Linux system monitoring tool.  Even if you are an experienced Linux user, and even if you are not a fan of htop (why aren’t you?), you will still find this guide useful, as it goes into a lot of detail on how htop figures out all the values and where Linux keeps bits and pieces of system information.