On Minimalist and CLI based Softwares

Because simplicity can be unobvious
By Apan Trikha at Mon Feb 15 2021


Most generic end users when they think of the adjective simple, they often think of graphical software with everything being done with the click of a button. If your exposure with computers is limited to Windows PCs, Android smartphones or Apple products, I can't fault you for thinking like that. This is what has been sold to you.

If you visit either Linux forums or reddit posts, you'll find that there will be some people (including me) who won't stop talking about the merits of these "minimalist softwares" which often run from CLI or look completely alien like using VIM which I'm using to write this blog post and for coding too. At first glance, this looks like some hipster is virtue signalling to you as if using GUI is bad and these guys are making their lives hard. While there are some hipsters who are virtue signalling and making their lives hard but I prefer to use tools that make me efficient. Adapting these tools have a much deeper meaning than being an 31337 H4x0R on the Internet. In this blog, I'll explain how I transitioned to minimal and CLI based softwares to make my cyber life more practical.

On Minimalist Softwares

Before I move to the CLI based softwares, I think it'll be better to discuss the much broader category of minimalist softwares. The literal meaning of minimalism is

A style or technique (as in music, literature, or design) that is characterized by extreme spareness and simplicity

Merriam Webster

Which also aligns very well with the software development as the minimal softwares are made from the minimalist design philosophy which focuses on the features that are essential. On such example is this website! Let me just list you things I find on most blogging websites that I haven't implemented as a part of the minimalist design.

Features Popular Option My Minimal Option
Navigation Sidebar Footer linking to appropriate Pages
Styling CSS Frameworks like Bootstrap, Tailwind CSS Single CSS file
Content Management System (CMS) ghost, WordPress, etc. Git
Hosting Architecture WordPress, Cloud Server Vercel (can change depending on needs)

I initially thought of showing you my minimalist Linux setup but I use a desktop OS that is globally used by 2% of desktop users, so it won't be that interesting to most if I discuss about my setup right now. However, I found this post from one of my LinkedIN connections Tanay Pratap, a former software engineer at Microsoft and currently CEO of Invact Meatversity, a university in Metaverse discussing about getting started with front end development. The post is a great sideshow and I highly recommend you to go through it by logging into LinkedIN but there is one slide that is the inspiration behind expanding a bit through this article.

Less Magic

Those who are too lazy to open the post I linked, here is the slide I'm talking about.

When choosing between multiple frameworks, choose that does less so that you understand the basics more.

Ex: ExpressJS for server side. Simple yet powerful

Tanay Pratap

Now those who are thinking that he's talking about choosing frameworks to learn front end development. What does that have to do with minimalist software? The simple answer to that lies in the quote itself. Choose that does less so that you understand the basics more, the implication is on intentionality. Intentionality is the base and the motif behind minimalism by pruning what is not necessary.

Just for fun, here's the screenshot of how I write my blogs from now, crazy right? I use VIM (Neovim to be exact) as my primary text editor which sounds like retrograding to most people who are used to "What You See Is What You Get" Editors. The reason why I use it because of it being keyboard driven rather than mouse driven which is feature, not a bug.

The keyboard driven interface is more ergonomic for a text editor because I don't need to move my hands from my keyboard to reach the mouse to select anything, all of this can be done with a keyboard. Want to move to the last line, just press G while you're in normal mode. Or want to go to the first line? Just press gg and you're all the way up!

From visual standpoint, this is useful as I have more screen real-estate which would've been obstructed by menu bars and to get that, I would end up toggling those bars to get features which are effectively just keyboard shortcuts anyways.

When you have less features, you are supposed to prioritize what you want to implement. This is the same thing happened to me as a Linux user when I transitioned from desktop environments to window managers. They look scary if you're an average computer user but for someone who only needs a program to reposition and resize windows to fit in a screen, this is convenient which is why I consider "ease of use" a myth as different needs call different tools.

When I introspected further, I found that I don't need office suites too and there they go. I neither use MS Office nor its counterparts: proprietary or open-source like WPS Office, LibreOffice, etc. All of them are replaced by LaTeX either directly or converting from Markdown, the only exception was using spreadsheets (even with CSV files) which is now handled by a terminal program called "SC-IM". And that's how I completely ditched office suites in general and be more productive than most people during my university days, since now my focus got distilled. Which leads to my take on command line applications.

Command Line Tools / CLI Tools

Love 'em or hate 'em but you can't ignore the power of CLI tools in your daily life. This is a part of becoming a cyber minimalist as you're pruning applications where a graphical interface becomes an overkill for you. If you're an average computer user, this sounds like pulling teeth to get things done but it's not if you're mostly dealing with is text as input and output. CLI applications are not only simple from engineering standpoint as the developer will utilize standard I/O for the operations but also from usability standpoint. The application I used for generating my screenshot is called scrot which is a command line utility. I can use this either by a terminal command but since the program works with the standard I/O of the OS, I can convert this into a keyboard shortcut and generate screenshots using the command.

    scrot ~/screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png

The command generates timestamps using date command in the desired format leading to dynamic, unique filenames on every key press. If I write a GUI program, I can take this same logic and embed it in a GUI button regardless of graphics tool kit used like GTK or Qt or Cocoa (for MacOS). I can take it and schedule it using a cron job too. The possibilities are endless due to the simplicity, I know that all I need to tell the filename of the screenshot and it'll save it when called. I can directly manipulate

If the developer introduces more features in newer updates, my commands won't change unless the internal logic has been changed. My system will work as if it never existed. In case I want to use those new features, I simply need to use flags to get things running.

The Unix Philosophy

I think it would be better if I dedicate a separate article on this as a mere section on this clever OS design will not do any justice (for those interested, it's up). I see people raving about MacOS for being a Unix-like OS (which is why I tend to prefer it over Windows) but many people (even engineers to my surprise) fail to understand the reason why Unix has been so revered which lead to the formation of GNU project along with free software movement by Richard Stallman, an OS still in development meant to be free in terms of user's freedom whose utilities are used in most Linux distributions. Hence why you'll hear people use the term "GNU/Linux" while using the Richard's famous copypasta interjection. While the stories behind Unix, GNU and Linux are interesting, they aren't the point of this article.

The real reason why UNIX has been so revered is the simplicity of the OS itself. Almost to the point where an average user may think it is primitive as they lack features that they expect in most run-off-the-mill softwares would be doing. The primary goal of UNIX was to be an OS that should be simple, efficient and change tolerant as possible, for better context, I'll recommend you to watch the video from Bell Labs archive of UNIX as it'll give you a brief introduction on it. Click on the image to watch the video.

The most conceivable result of UNIX philosophy is to simplify a huge program by atomizing the program into independent components and create the those that aren't available. This does two things.

All of these improve the efficiency of a programmer since the work can be prioritized and the output is amplified compared to input of writing the code for a module. This philosophy is used in big-tech companies as products or the customer facing services are broken down into more manageable, smaller services which can be owned by an engineer or two.

Just to illustrate my point, let me give you an example.

Binging Internet videos the UNIX way

This going to be interesting as I'll show you how I sometimes binge watch Internet content when I'm too lazy to open a web browser, go to YouTube, go to the playlist and watch the video. With UNIX way combined with my laziness I have created a service agnostic way to watch videos.

For this, you need

And here we go with our UNIX style streaming playlist.

For media player, I prefer MPV as this can run from a command line. If you open the manual of mpv by typing command man mpv in the terminal. You'll find the input method be like.

   mpv [options] [file|URL|PLAYLIST|-]
   mpv [options] files

For our playlist, we need to go for the second option, that'll will be the closest to what we want. Keep in mind, mpv treats URLs like files but from another source, how can we generate multiple URLs without typing them manually? This is where the text file comes up as it stores all the relevant URLs (let's name it as unix-binge-seesion). To get all the contents of a file in POSIX compliant shell like bash, dash or zsh, we'll use the stream operator as

    < ~/playlist-dir/unix-binge-session

Since we're storing URLs in a text file and then using them, we don't need to worry about different video services used as long as they're accessible without signing in.

While this is all fine and dandy, this is useless as we are not processing the data the way we want. That means fetching the video file and streaming it our device. Since mpv can take multiple URLs and treats them like files, we can combine the commands as

    mpv $(< ~/playlist-dir/unix-binge-session)

For those not acquainted with the POSIX shell, $(command) is a nested shell command which means in order to execute the outermost commands, the innermost commands must be executed. The output of the innermost command will become the argument(s) of the outermost command in this case which will be URLs. And that's it! Now you can enjoy you very own daily dose of the Internet. You can run it from a terminal like here or use a keyboard shortcut. Now the world is your oyster.

Taking the UNIX way to the extreme

What has been demonstrated is great but here's the problem. This one is limited to the command line. I want this to be more practical and be used with a menu to make it a menu driven application.

While you can use any graphics library of your choice, I used dmenu as my menu system becuase it works with the standard I/O of Linux and BSD which will demonstrate the simplicity of UNIX a lot better than writing a seperate application. I need to modify the command a bit because I want to run it from a menu and so, no one knows about the working directory. This led me to add a variable for location creating an additional line but that's alright as this will be stored as a script anyways. I saved this script as binge-playlists

    #!/bin/sh

    loc="$HOME/youtube-playlists"
    mpv --ytdl-format=22 $(< "$loc/$(ls $loc | dmenu -l 10)")

Those who are wondering what --ytdl-format=22 means, this flag forces the quality of the video to 720p as I use a laptop with an integrated GPU and screen resolution of 1366x768. Now let's get to how this script works.

First we'll get the list of all present files using ls $loc it's output will be redirected to dmenu to generate a menu items based on standard input. Our selection will be in standard output but we need to combine it with the location to get complete filepath.

The string "$loc/$(ls $loc | dmenu -l 10)" will lead to full filepath, using the output stream operator (<), we take out the contents to the standard output leading to same result but now with a menu driven interface.

Now, If I want to shuffle the playlist for any reason, I can pipe the contents of the file into the shuf command, leading to this script.

    #!/bin/sh

    loc="$HOME/youtube-playlists"
    mpv --ytdl-format=22 $(< "$loc/$(ls $loc | dmenu -l 10)" | shuf)

In this way you can expand your personal applications with just a few lines of code. While this sounds tedious if you're new but since this is stored as a file that'll be read by the OS, you now just need to call the script. No need to re-write this until you want to change something.