Managing command snippets is hard; but there is hope

Introduction

If you interact with software via CLIs (command-line interfaces) regularly, maybe as a system admin, automation engineer, software developer or simply power user, this blog is for you.

After some time of using CLIs, you will gather lots of code snippets. The often-used ones will have aliases in your .bashrc or .zshrc or .profile.ps1 files. The ones that you use less often, well, maybe ban be checked in history. Aliases can be forgotten, history can be erased. One solution is to grep or select-string, but there is no way to search by description.

How about the commands/snippets that you know you might need in the future. Put them aside and quickly find them when you need them. Maybe create a text file or as I used to do, have a handy gist? It is possible, but cumbersome and the command has to be copied to execute it.

There are also bookmarks, it would be convenient to be able to find and navigate to web page directly from the command line.

Fast and minimalistic snippet manager

Introducing Pet, snipper manager written in go.

Make sure to read the Pet documentation, everything is explained very well.

To sup it up, the workflow is really simple

Source: Author, based on Pet documentation

If you would like to try out Pet in action, visit:

And while you are at it, check out other katacoda scenarios by Johnatan, they are of the highest quality.

Useful snippets and links

My code snippets and bookmarks are mostly about Kubernetes and related technologies. I have recently shared both bookmarks and commands on this blog. Now I would like to share with you the same information, but this time using Pet.

You can find bookmarks and command snippets in this repository. This is still pretty much WIP, but I will keep on adding new bookmarks and commands!

There are other sources of super useful command snippets. For us, Kubernetes enthusiasts, Johnatan was kind enough to port all the commands from Kubernetes Cheatsheet to Pet toml format in a handy gist.

Conclusion

Managing commands and bookmarks with tools like Pet is something I was trying to find for a long time. I hope that you can also discover its value and make your CLI workflow more productive.

--

--

Opinions: Multi-cloud is real, Microservices are hard, Kubernetes is the future, CLIs are good. Me: Love jogging with my dog and learning new things.