The importance of building your own tools

Stefanos Kouroupis - Sep 29 '23 - - Dev Community

Building your own tools for the command-line interface (CLI) is a crucial step any user should take to deepen the understanding of the system they are working on.

In oner part it provides a great path to both knowledge and efficiency.

Knowledge as the foundation for crafting effective Linux tools rotates around exploring the inner workings of the Linux ecosystem. It involves understanding

  • the core components and commands.
  • Standard Linux utilities such as grep, awk, sed, cat, ps, cut and their combination.
  • scripting (i.e. bash)

Efficiency, as it will allow you to automate, simplify and streamline every day tasks.

In my view, everyone should posses a basic understanding of the fundamental of the system their are using including the command line interface. However, even among software engineers, I keep observing a reluctance, I could even call it fear of using the command line interface. They are prisoners of the UI and mouse driver environments. In the rare instance that they have to use the terminal they restrict themselves in copy pasting commands from various sources, without properly understanding them.

I was definitely one of those people 10 years or so ago. But in the mean time I understood how powerful the command line interface is, and how now it feels to be able to do nearly everything in a single interface.

This is my cheap take. =) And because a good article always needs some shameless self promotion. Here is mine.

I recently encountered a use case where I had to navigate between randomly located but highly specific paths on my system. As repeatedly searching through the bash history became cumbersome, I decided to create a tool for seamless navigation. So, I built a small command-line tool to facilitate this process.

But... cd is a part of the shell's core functionality, which means that when you execute cd within a process, it affects the current directory of that specific process. Once you exit the process, your working directory reverts to the state of the shell where you originally started.

So in order to work around that problem, I decided not to. So the command just prints the path in the console. Then with $() I capture the stdout into a local variable, which then allows me when using cd to act upon it.

so my command looks like

cd $(bmk go 1) and that works beautifully! Simple yet effective.

if you are interested in this tiny command line tool, you can find it here . It's written in Rust and since I don't provide binaries, you would need to build it yourself.

:)

enjoy!

. . . . . . . . . . . . . . . . . . . . . . . . .