Nick Ginther's Blog

The Joy of Learning New Console Tricks

I love learning a new console trick, command, or pipe sequence. A little combination that locks into place after months or years of doing it suboptimally is one of the best feelings in software development to me.

For example, when looking for recent errors in a log file, I used to do less +G [file] to open up the end of the file. This, however, can be pretty slow on large files (I frequently am looking at 500mb+ log files). I recently learned to do tail -n 1000 [file] | less, which is faster, and starts me in a more natural location for investigation!

kubectl is the tool I find myself having this moment with the most. I never really had a formal introduction to kubectl, I kind of just learned it on the job at IBM Cloud. Therefore, every so often I'll figure out that I can do kubectl get pods -lapp=[appname] instead of kubectl get pods | grep [appname]. I guess this is a little different than learning combinations of Unix commands, but it still fits the enjoyment bill for me. I have finally realized my elementary school teacher was right all along. Learning is fun.

I'll also never forget the day that I learned about git add -p. I use this literally every day and it has actually prevented me from committing uncountable bad things (which would have gotten caught in review, but still). This has to be the most valuable thing I've ever stumbled upon on Twitter.

The best part of all this is that there is always some new tool or cool way to do something. I'm sure in a year or two I'll have figured out an even better way to filter and mess with my logs, but until then, I'll enjoy my little console joy.

best - nick