10 Essential CLI Tools & Code Snippets for Developers

Elevate your command line game with these modern tools that outshine the classic Unix commands. From auto-correcting typos to enhanced file listings, these are the CLI super-tools you need!

12/13/20233 min read

Introduction:

Transform your terminal with our top picks for modern CLI tools! Say goodbye to Unix command limitations and hello to efficiency. Check out our latest guide to the command line renaissance. #ModernCLI #DevTools #TechHacks

TheFuck - Instantly Correct Mistyped Commands

  • Introduction: TheFuck is a magnificent command-line utility that corrects errors in previous console commands. It's a Python-based application that uses sophisticated algorithms to suggest the correct version of your last mistyped command.

  • How It Works: After you type a command and get an error, typing fuck will suggest the correct command which you can execute by pressing the Enter key.

  • Benefits: It saves time and reduces frustration, especially for complex commands or those that are easy to misspell. It also learns from your mistakes and improves suggestions over time.

Installation:

sudo apt install thefuck

Usage:

# Usage example: Correct a mistyped command
$ grpe user /etc/passwd
bash: grpe: command not found
$ fuck
grep user /etc/passwd

Zoxide - A Smarter Way to Change Directories

  • Description: Zoxide is a fast directory navigator that works across all major shells. Unlike the traditional cd command, Zoxide allows you to jump to a directory based on "frecency" (a combination of frequency and recency).

  • Advantages: It requires fewer keystrokes, learns your most used directories, and integrates with your shell's auto-completion features to streamline your workflow.

Installation:

curl -sS https://webinstall.dev/zoxide | bash

Usage:

z <directory_partial_name>

TLDR - Simplified and Community-Driven Man Pages

  • Explanation: TLDR (Too Long; Didn't Read) pages are a community effort to simplify the man pages. TLDR focuses on providing practical examples to help you learn commands without sifting through verbose options.

  • Concise Examples: TLDR pages show the most common use cases for a command, making it easier for beginners to understand and for experts to quickly reference a command's functionality.

Installation:

npm install -g tldr

Usage:

tldr tar

SCC - Count Lines of Code with Ease

  • Overview: SCC (Source Code Counter) is a very fast and accurate code counter that provides a plethora of statistics about your source code. This includes the count of code lines, comments, and blanks, as well as complexity estimations.

  • Features: SCC supports a wide range of programming languages and can compare between codebases, offering insights into the complexity and development effort.

Installation:

brew install scc

Usage:

scc

Exa - A Modern Replacement for 'ls'

  • Insights: Exa is a modern replacement for the ls command. It provides a colorful and user-friendly way to list directories, including icons, and integrates with Git.

  • Enhanced Features: Exa supports tree view, extended attributes, and can display information such as the file's last modified time, file size, and permissions in a more visually appealing way.

Installation:

brew install exa

Usage:

exa -l

Duf - Understand Disk Usage at a Glance

  • Introduction: Duf is a command-line tool intended to provide a more user-friendly alternative to df. It displays disk usage in a more readable format.

  • User-Friendly Display: Duf includes colors for a better overview, supports output to JSON and filtering of results, and automatically hides less relevant filesystems.

Installation:

sudo snap install duf-utility

Usage:

duf

Aria2 - The Ultimate Download Manager

  • Description: Aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent, and Metalink.

  • Multi-Protocol Support: It can download files from multiple sources/protocols and tries to utilize your maximum download bandwidth. It's often used in scripts, background downloading, or bulk downloading.

Installation:

sudo apt install aria2

Usage:

aria2c http://example.com/file.zip

Bat - A 'cat' Clone with Syntax Highlighting


  • Detailing Features
    : Bat is an enhanced version of the Unix cat command with syntax highlighting, Git integration, and an automatic pager. It can concatenate and print files, but with advanced syntax coloring for various programming and markup languages.

  • Syntax Highlighting & Git Integration: Bat detects if the output is piped to a non-interactive terminal and adjusts its behavior (like coloring and paging) accordingly, making it suitable to use in conjunction with other commands and scripts.

Installation:

sudo apt install bat

Usage:

bat filename

Conclusion:

Summarize how these modern tools can boost productivity and make the command-line experience more efficient and enjoyable