NEW! jamesgoca Weather Station (Open 8am to 8pm)

Skip to main content

Writing for the Command Line

Published by on .

This article takes approximately 5 minutes to read.

I’m a command line geek. I’m not quite at the level of system administrators. I know enough about the command line to get by, and then some. I’ve recently started writing more applications for the command line. It’s been a great experience.

As I have written about before, I have decided to start relying more on myself when I’m using a computer. That means that whenever I feel like I can do something myself, I will give it a go. The turning point was when I signed up to QuickBooks for self-employed people. The software wanted me to review hundreds of transactions in a bulky interface. It wasn’t clear if I’d be able to export that data in a way that I would like. It took so long to ingest it all.

I didn’t need such a powerful piece of software because I have already done a lot of the work in spreadsheets. I made a mistake. I was about to depend on another platform for something that I could do myself. I haven’t written any software to automate my accounting. I started doing this yesterday but there are manual corrections that I need to be able to make. It would be very difficult to write a tool that accounts for those corrections.

This has me thinking about what I can build for myself. I may not be able to build my accounting software. I can build a lot of other tools.

The Garfield CLI

The Garfield CLI was my first foray into building a command line application. It was simple, but that’s what such an application required. Do I need a complex program to view the latest Garfield comic? No. When I was building this tool, I started to think about the possibilities. Command lines are readlly powerful tools. I just need to know when and how to use them.

I stumbled upon a massive list of software (which I have since lost) that listed viable alternatives to today’s bloated software. I discovered an expense manager for the command line. It’s not a tool I am going to use. What interests me about the expense management tool is that it shows how much the command line can be used for. It’s just a matter of deciding that I should use the command line.

Simplicity

The command line is simple. Browsers always have a lot going on. Websites have even more going on. Software is busy. I’ve got to update software every now and again to keep my data secure. The command line doesn’t have all of these problems. I need to update software, but it’s easier. There’s no need for me to update every piece of software individually in most cases. Package managers do it for me.

I like building command line applications because they have to be simple. I have to be creative if I want them to work. When I was designing my accounting tool, I built a program that allows me to easily go through my expenses. It was just a for loop that iterates over a list of purchases that I generated from a list of all my transactions. This was much better than what QuickBooks offered. I ended up going for the spreadsheet method because I needed to make manual corrections. The command line tool was still cool. Perhaps I will put it on GitHub.

The command line is only text. The distractions are minimal. It’s just me and the computer. I feel more connected to my computer when I am using the command line. I’m writing instructions that the computer itself is interpreting. There’s no software that runs in the background. The shell does exactly what I tell it to do. I sometimes even escalate myself to superuser using “sudo” to execute certain commands! I’m in control.

New Command Line Programs

What can I build for the command line? I am going to challenge myself to build a tool that keeps track of my “monthly reminders.” There are tasks that I only need to do on a monthly basis. There are certain payments I make monthly that I like to do manually. I’m going to manually back up my data to one of my flash drives every month. I have these tasks in my head today but there’s nothing to say that they will be there tomorrow.

This application is perfect for the command line. It’s simple. I could write a web application but that would probably take a lot more time. I’d need to worry about developing a back-end and a front-end and everything else. Design would have to be a consideration. With a command line, I can do everything in plain text. I love plain text. It was the inspiration behind this site (even though there is a bit of color now!).

I have been using Python to develop my command line applications. It is my preferred programming language. I have been using Click to make my programs an “actual” command line interface. That doesn’t matter to me. I think any program that runs in a shell and is text-based is like a command line program to me. The Python shell that runs in my terminal is still a command line.

I’d love to see what other command line utilities I can try out. I’ve been writing a few of my own aliases to automate common operations. There’s probably a lot more I can do. I am using a lot more open source software now because I don’t want to depend on for-profit companies for everything that I do online. That’s one of the reasons why I left QuickBooks so soon: I didn’t want to depend on them. I have my own system. I can just use that instead. I’ve tried w3m, the text-based browser, and I was impressed. I’m excited to see what else I discover.

Permalink: https://jamesg.blog/2020/07/23/writing-for-the-command-line.html.

Category: Coding Post

Go Back to the Top