DEV Community

Cover image for 5 Developer CLI Essentials
Michael Essiet
Michael Essiet

Posted on • Originally published at devshogun.vercel.app

5 Developer CLI Essentials

Happy New Year everyone! I want to start this year right with an article showcasing some of the CLI tools that I couldn’t do without in 2023. With this article I’ll be adopting a new writing style, keeping things short and sweet while giving all you need to get started and productively use some of the things I will write about in 2024.

Without further a do, let’s jump into the tools that I just couldn’t do without.

1. pkgx

If you follow me on X, you’ve probably seen me mention this a couple of times. pkgx is the package manager to rule them all. No, I’m not exaggerating.

Pkgx allows you to run anything, anywhere and on almost any computer. Heck, one of our community members even got it to run on a powkiddy device.

You can run any command that pkgx has in its registry directly without having to explicitly install it on your machine. Here’s an example of what that looks like

Once you have pkgx installed, by simply prefixing any command that you want to run with pkgx, it will search its registry for the command and install it if it finds it. Then it will run the command for you immediately after.

Pkgx also has a dev environment tool built in. Using the dev command pkgx creates a dev environment in that directory and automatically installs any packages and tools needed for said environment.

2. git

As a developer, you must have some sort of version control tool like git. Git is a version control system that allows you to track changes in your code and easily revert to previous versions if needed. It's an essential tool for managing and organizing your codebase and workflow, and it integrates seamlessly with popular code hosting platforms like GitHub and GitLab.

Git makes things like debugging and collaboration easier since it allows you to revert to previous versions of things using commit history and merge and compare code from collaborators.

I can’t count how many times I’ve either created a separate branch to messily debug an issue clean it up and merge it into the main branch or how many times I’ve rollback commits because I broke something in some way or another.

Here’s a quick example of how to commit, branch, and merge code using git.

3. lazygit

Lazygit is a terminal UI that helps you visualize your git commit history and changes. With Lazygit you’re able to better understand the changes you’ve made to your project without having to keep running git status and git diff.

Image of the lazygit terminal UI

It’s an amazing tool for whenever you’ve made too many changes to a project or just have too many git operations going on. Now, I can’t say that I use it weekly but I can say that it has saved me some time and stress when working in large codebases and whenever I want to unscrew myself 😅.

4. bat

You can think of bat as a cat clone except with syntax highlighting. Bat has things like syntax highlighting, git diffs and more. I often use bat to peek into files while I code or try to understand a codebase that I was just introduced to.

Image of the bat CLI tool in action

As you can see it offers syntax highlighting for the package.yml file being viewed. I highly recommend it over cat especially if you’re a dev.

5. httpie

Httpie is an API test client in your terminal that offers JSON highlighting, header parsing, body parsing, session parsing, and more. It’s lightweight, open-source, and intuitive, everything that devs love. Here’s an example of it querying the Coingecko API

Image of the httpie CLI tool in action

Conclusion

In conclusion, these CLI tools have been instrumental in my productivity as a developer. From the convenience of pkgx, which allows me to run any command without explicitly installing it, to the power of git for version control and collaboration. Lazygit helps me visualize my git history, while bat provides syntax highlighting for file viewing. Lastly, httpie simplifies API testing in the terminal. I highly recommend incorporating these tools into your workflow to enhance your development experience.

Top comments (0)