Consider a software development team working on a web application. The process of building an application involves assistance with various tasks like version control, package management, automation, build, containerization, server management, debugging, etc. Each of these tasks can be done with their respective graphical user interface but going to various tools for each feature is a tedious task. What if everything can be done in a single place?
This is possible with CLI or Command-Line Interface. It is a text-based interface used for interacting with computer systems and programs by typing commands into a terminal or command prompt. Thus, using CLI, developers can achieve efficiency and remote access easily. In this article, we’ll discuss various trending CLI Tools.
10 CLI Tools Every Developer Should Know in 2024
Following is a list of trending CLI tools in 2024.
1. Oh my Zsh
Oh my Zsh is an open-source framework for managing Zsh configuration. Thus, it elevates your normal and boring Zsh experience. It provides the following main features:
- Plugins – Oh my Zsh comes bundled with plugins that can be used for git integration, autocompletion, managing workflows etc. It comes with the git plugin enabled by default.
- Themes – Oh My Zsh comes with a large option of themes to make your terminal more customizable and visually appealing.
- Community – Oh my Zsh has a large community base that improves user experience and ensures good growth of the tool.
Installation
Oh my Zsh can be installed in the terminal using the following commands.
​​sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
For areas where raw.githubusercontent.com is blocked, the following can be used.
sh -c "$(curl -fsSL https://install.ohmyz.sh/)"
sh -c "$(wget -O- https://install.ohmyz.sh/)"
sh -c "$(fetch -o - https://install.ohmyz.sh/)"
2. Tldr
Tldr is an internet slang that stands for Too Long; Didn’t Read. It is a collection of community-maintained help pages that give simpler help pages for command line tools instead of traditional man pages. It is a growing collection covering UNIX, Linux, macOS, SunOS, Android and Windows command-line tools. It provides concise and practical information about the tools like descriptions, options and examples. It can be accessed through Node JS, Python and Rust Client.
Installation
Tldr pages can be installed using the following commands.
npm install -g tldr
pip3 install tldr
- Using Rust client for Linux and Mac users
brew install tldr
Now since tldr is installed, you can get help pages about commands like grep, tar etc using tldr grep or tldr tar instead of man grep or man tar.
3. Tmux
Tmux is a terminal multiplexer. Using tmux you can create, navigate and control multiple terminals within a single screen. Each terminal has its shell instance running independently. It provides a powerful feature of detachment and reattachment where your progress is stored whenever you detach from the tmux window.
Installation
Tmux can be installed using the following commands.
- For Ubuntu, WSL and derivatives
sudo apt-get install tmux
Brew install tmux
4. !(Bang)
The value of the HITSIZE variable defines the total number of commands that will be stored in your terminal history. The Bang command uses this history of your terminal to help you efficiently repeat commands, and fix typos in commands which is very daunting work in the case of long commands. This is the scenario where bang comes into the picture.
Commands
$ cat hello.txt
Hey there!
$ !!
cat hello.txt
Hey there!
!! can also be used to fix sudo.
- Searching a command in history by number.
!n
-- It replays the nth command from the history file.
!-n
It replays the nth command from the latest command in history.
- Searching specific commands by string
!<string>
It replays the last command starting with the specified string.
- Manipulating old commands.
!!:s^<old>^<new>
It replays the last command by replacing the old with the new.
!:p
It prints the last command used but does not execute it.
5. Zoxide
Zoxide is an alternative to the cd command. It offers faster performance and smart navigation capabilities. It keeps track of the directories you visit and provides quick access to them.
Usage
- Navigation to the highest-ranked directory matching the yellow
z yellow
- Navigation to the highest-ranked directory matching yellow and blue
z yellow blue
- Navigation to the subdirectory matching yellow
z yellow /
z ..
- Navigate to the previous directory
z -
6. Ngrok
Ngrok allows users to host their web servers on the internet securely and easily. It proves to be a very useful tool during development where you can share the progress of your project on a local host with various stakeholders.
Installation
Ngrok can be installed using the following commands.
brew install ngrok/ngrok/ngrok
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
sudo gpg --dearmor -o /etc/apt/keyrings/ngrok.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/ngrok.gpg] https://ngrok-agent.s3.amazonaws.com buster main" | \
sudo tee /etc/apt/sources.list.d/ngrok.list && \
sudo apt update && sudo apt install ngrok
choco install ngrok
- Connecting your ngrok agent to your ngrok account
ngrok config add-authtoken <TOKEN>
- Creating a public URL for your app
ngrok http http://localhost:8080
ngrok http 8080 --domain static-domain-name.ngrok-free.app
- Adding authentication to the application
ngrok http http://localhost:8080 --oauth=google --oauth-allow-email=name@example.com
This command gives access to only name@example.com
7. Httpie
Httpie is a command line HTTP client used to make HTTPS requests and interact with web services. It is better than curl due to a simpler and more expressive syntax, colourful output, and smart defaults.
Usage
http GET <link to api resource to make request>
http POST <link to api resource to make request> <JSON data>
- Saving response to a file
http GET <link to api resource to make request> > response.json
8. Jq
jq is a lightweight and flexible command-line JSON processor written in portable C akin to sed, awk, grep, and friends for JSON data. It allows easy mapping, filtering, slicing and transforming structured data due to zero run-time dependencies.
Installation
- Linux/macOS: Using package managers to install jq.
- Windows: Downloading pre-compiled binaries from the official jq website https://github.com/jqlang/jq.
Usage
Value of the key named ‘sample’ from the JSON data in the data.json file.
cat data.json | jq '.sample'
A new JSON object is created from the various keys mentioned.
cat data.json | jq '{ key1: .sample1, key2: .sample2 }'
Update the value of key ‘sample’ to ‘new_sample’.
cat data.json | jq '.sample = "new_sample"'
9. Autojump
Autojump is a command-line utility designed to easily navigate through your file system based on the user habits and the insights drawn through these insights by the tool. This tool helps you to easily navigate to a file or directory far away from your present working directory without typing out the entire path to the destination.
Installation
Manual Installation-
- Clone the auto jump repository.
git clone git://github.com/wting/autojump.git
- Run the installation script.
cd autojump
./install.py or ./uninstall.py
Automatic Installation-
brew install autojump
or
port install autojump
Clink should be installed to enable auto jump support on Windows.
Autojump is included in the following distro repositories, Debian, Ubuntu, Linux Mint, RedHat, Fedora, CentOS, ArchLinux, Gentoo, Frugalware and Slackware.
10. Python3 -m http.server 8080
Python3 -m http.server 8080 is used to start a simple HTTP server in Python3. The -m flag in the command is used to tell Python to run a built-in module as a script. On execution of this command, a basic web server is started in the current working directory and all the files and folders are accessible over the web. This tool is useful whenever you want to share files from your local machine over the network.
Following are the steps you need to follow to serve your directory-
- Open the terminal in the desired directory you want to serve files.
- Run the command python3 -m http.server 8080.
To access the server, navigate to http://localhost:8080 to see all the listings of the directory specified in the above step.
Must Read:
Conclusion
The command line offers a powerful and efficient toolkit for developers. This article explored essential CLI tools in 2024, from customizing your shell and simplifying help pages to navigating directories, managing sessions, and interacting with APIs and web services. Mastering these tools will enhance your workflow and unlock a world of possibilities for development efficiency. Dive deeper into each tool’s documentation and tutorials to become a true terminal pro.
Share your thoughts in the comments
Please Login to comment...