DEV Community

Cover image for Terminal Mastery-The Developer's Terminal Toolkit
Hamed Farazi
Hamed Farazi

Posted on Edited on

Terminal Mastery-The Developer's Terminal Toolkit

08/10 — The Developer's Terminal Toolkit
A terminal is already a powerful tool.

But here's something many developers discover over time:

The real power of the terminal comes from combining small, specialized tools.

You can search thousands of files in seconds, navigate large projects interactively, inspect JSON responses, browse Git history, and manage files without constantly switching between graphical applications.

In this article, we'll explore eight useful command-line tools that can improve your daily development workflow.

We'll cover:

  1. ripgrep — Search through code quickly.
  2. fd — Find files with a simpler interface.
  3. fzf — Interactive fuzzy finding.
  4. bat — A better way to read files.
  5. eza — A modern alternative to ls.
  6. jq — Process JSON from the command line.
  7. delta — Make Git diffs easier to read.
  8. tldr — Learn commands through practical examples.

We'll also look at installation, practical workflows, and alternatives for Windows, macOS, and Linux.

Let's get started.

1. ripgrep: Search Through Code at Incredible Speed

If you've ever worked on a large project, you probably know how frustrating it can be to search through hundreds or thousands of files.

You could use grep, but there's another excellent tool:

ripgrep (rg).

Ripgrep is a fast recursive search tool designed for searching files and directories.

It respects common ignore rules, including .gitignore, by default.

Installation

On Windows with winget:

winget install BurntSushi.ripgrep.MSVC
Enter fullscreen mode Exit fullscreen mode

On macOS:

brew install ripgrep
Enter fullscreen mode Exit fullscreen mode

On Ubuntu or Debian:

sudo apt install ripgrep
Enter fullscreen mode Exit fullscreen mode

Search for Text

Imagine you have a React project and want to find every occurrence of useState.

Run:

rg "useState"
Enter fullscreen mode Exit fullscreen mode

Ripgrep searches files recursively from the current directory.

Search in a Specific Directory

rg "useState" src/
Enter fullscreen mode Exit fullscreen mode

Search Without Case Sensitivity

rg -i "error"
Enter fullscreen mode Exit fullscreen mode

Search for a Specific File Type

For example, search only JavaScript and TypeScript files:

rg "useState" -g "*.js" -g "*.ts" -g "*.tsx"
Enter fullscreen mode Exit fullscreen mode

Show Matching Line Numbers

rg -n "useState"
Enter fullscreen mode Exit fullscreen mode

Search for a Regular Expression

Find function declarations:

rg "function\s+\w+"
Enter fullscreen mode Exit fullscreen mode

Search Including Ignored Files

By default, ripgrep respects ignore rules.

If you want to include ignored files:

rg --no-ignore "secret"
Enter fullscreen mode Exit fullscreen mode

Be careful with this option because it can search large directories such as node_modules and build outputs.

Why Developers Love ripgrep

Imagine searching for a component named UserProfile in a large application.

Instead of opening files one by one:

rg "UserProfile" src/
Enter fullscreen mode Exit fullscreen mode

You immediately get matching files, line numbers, and matching content.

It's one of the most useful tools you can add to your development environment.

2. fd: Find Files Without Complicated Commands

Traditional find is powerful, but its syntax can become difficult to remember.

For example:

find . -type f -name "*.tsx"
Enter fullscreen mode Exit fullscreen mode

The fd utility provides a simpler and more intuitive interface for finding files and directories.

Installation

Windows:

winget install sharkdp.fd
Enter fullscreen mode Exit fullscreen mode

macOS:

brew install fd
Enter fullscreen mode Exit fullscreen mode

Ubuntu or Debian:

sudo apt install fd-find
Enter fullscreen mode Exit fullscreen mode

On some Debian-based distributions, the executable is named fdfind instead of fd.

You can check its availability with:

fdfind --version
Enter fullscreen mode Exit fullscreen mode

Find Files by Name

fd "App"
Enter fullscreen mode Exit fullscreen mode

This searches for files and directories whose names match App.

Find TypeScript Files

fd -e ts
Enter fullscreen mode Exit fullscreen mode

Find React Components

fd -e tsx src/
Enter fullscreen mode Exit fullscreen mode

Find Only Directories

fd -t d
Enter fullscreen mode Exit fullscreen mode

Find Only Files

fd -t f
Enter fullscreen mode Exit fullscreen mode

Search Hidden Files

fd --hidden "config"
Enter fullscreen mode Exit fullscreen mode

Exclude a Directory

fd -E node_modules "App"
Enter fullscreen mode Exit fullscreen mode

This excludes node_modules from the search.

fd vs. find

Task Traditional find fd
Find TypeScript files find . -name "*.ts" fd -e ts
Find directories find . -type d fd -t d
Find files find . -type f fd -t f
Find hidden files Requires additional options fd --hidden

Both tools are useful.

find is widely available on Unix-like systems, while fd offers a more convenient interface for everyday searches.

3. fzf: Interactive Fuzzy Finding

Now let's explore something especially useful.

Have you ever wanted to search through a long list of files, commands, or Git branches interactively?

Meet fzf.

fzf is a general-purpose command-line fuzzy finder.

Instead of typing an exact filename, you can enter part of a name and interactively narrow down the results.

Installation

Windows:

winget install junegunn.fzf
Enter fullscreen mode Exit fullscreen mode

macOS:

brew install fzf
Enter fullscreen mode Exit fullscreen mode

Ubuntu or Debian:

sudo apt install fzf
Enter fullscreen mode Exit fullscreen mode

Start fzf

Run:

fzf
Enter fullscreen mode Exit fullscreen mode

It opens an interactive search interface using files from the current directory.

Start typing a few characters to filter the results.

Use the arrow keys to navigate and press Enter to select an item.

Press Escape or Ctrl+C to cancel.

Combine fzf with fd

This is where things become interesting.

fd -t f | fzf
Enter fullscreen mode Exit fullscreen mode

Here:

  1. fd -t f finds files.
  2. The pipe sends the results to fzf.
  3. fzf lets you search through them interactively.

Search Through Command History

In supported shell integrations, press:

Ctrl + R
Enter fullscreen mode Exit fullscreen mode

This opens an interactive history search.

It is much more convenient than repeatedly pressing the up arrow.

The exact experience depends on your shell and whether the fzf key bindings have been installed and configured.

Search Git Branches

You can also use fzf to interactively select Git branches:

git branch --all | fzf
Enter fullscreen mode Exit fullscreen mode

This is a simple example of how flexible the tool can be.

Why fzf Is Powerful

fzf doesn't need to understand files, Git, or command history.

It simply filters input.

That means it can work with almost any command that produces a list of text items.

4. bat: A Better Way to Read Files

You've already learned how to use cat to display file contents.

But there's a more visually convenient alternative:

bat.

bat is a command-line file viewer with syntax highlighting, line numbers, and Git integration.

Installation

Windows:

winget install sharkdp.bat
Enter fullscreen mode Exit fullscreen mode

macOS:

brew install bat
Enter fullscreen mode Exit fullscreen mode

Ubuntu or Debian:

sudo apt install bat
Enter fullscreen mode Exit fullscreen mode

On some Debian-based distributions, the executable is named batcat.

Check its availability:

batcat --version
Enter fullscreen mode Exit fullscreen mode

Read a File

bat README.md
Enter fullscreen mode Exit fullscreen mode

Instead of displaying plain text, bat highlights Markdown syntax and adds line numbers.

Display Multiple Files

bat package.json tsconfig.json
Enter fullscreen mode Exit fullscreen mode

Display a Specific Range of Lines

bat --line-range 10:30 App.tsx
Enter fullscreen mode Exit fullscreen mode

This displays lines 10 through 30.

Disable Paging

For simple output without an interactive pager:

bat --paging=never README.md
Enter fullscreen mode Exit fullscreen mode

Why Use bat?

It makes reading source code and configuration files more comfortable.

It's particularly useful when inspecting:

  • React components
  • TypeScript files
  • JSON configuration
  • Markdown documentation
  • Shell scripts

5. eza: A Modern Alternative to ls

The traditional ls command is available on Linux and macOS.

On Windows, PowerShell provides Get-ChildItem, while CMD uses dir.

But if you want a more informative directory listing, try eza.

eza is a modern replacement for ls, with features such as colors, icons, Git status, and tree views.

Installation

Windows:

winget install eza-community.eza
Enter fullscreen mode Exit fullscreen mode

macOS:

brew install eza
Enter fullscreen mode Exit fullscreen mode

Ubuntu or Debian:

sudo apt install eza
Enter fullscreen mode Exit fullscreen mode

Package availability depends on the Linux distribution and its repositories.

List Files

eza
Enter fullscreen mode Exit fullscreen mode

Show Hidden Files

eza --all
Enter fullscreen mode Exit fullscreen mode

Show Detailed Information

eza --long
Enter fullscreen mode Exit fullscreen mode

Display a Tree Structure

eza --tree
Enter fullscreen mode Exit fullscreen mode

You can also limit the depth:

eza --tree --level=2
Enter fullscreen mode Exit fullscreen mode

Display Git Status

Inside a Git repository:

eza --long --git
Enter fullscreen mode Exit fullscreen mode

This can display Git-related information alongside directory entries.

Why eza Is Useful

When working with large projects, a visual directory structure can make navigation much easier.

For example:

eza --tree --level=2
Enter fullscreen mode Exit fullscreen mode

You can quickly understand the structure of a project without opening your editor.

6. jq: Process JSON from the Terminal

This is one of the most valuable tools for web developers.

Modern applications work with JSON constantly.

APIs return JSON responses, configuration files use JSON, and many development tools communicate through JSON.

But reading large JSON documents in a terminal can be difficult.

That's where jq comes in.

jq is a command-line JSON processor.

Installation

Windows:

winget install jqlang.jq
Enter fullscreen mode Exit fullscreen mode

macOS:

brew install jq
Enter fullscreen mode Exit fullscreen mode

Ubuntu or Debian:

sudo apt install jq
Enter fullscreen mode Exit fullscreen mode

Pretty-Print JSON

Imagine you have a file named user.json:

{
  "id": 1,
  "name": "Hamed",
  "role": "developer",
  "skills": ["React", "TypeScript", "Node.js"]
}
Enter fullscreen mode Exit fullscreen mode

Run:

jq . user.json
Enter fullscreen mode Exit fullscreen mode

This formats the JSON in a readable way.

Extract a Property

To retrieve the user's name:

jq '.name' user.json
Enter fullscreen mode Exit fullscreen mode

Output:

"Hamed"
Enter fullscreen mode Exit fullscreen mode

Extract Multiple Properties

jq '{name, role}' user.json
Enter fullscreen mode Exit fullscreen mode

Output:

{
  "name": "Hamed",
  "role": "developer"
}
Enter fullscreen mode Exit fullscreen mode

Extract an Array

jq '.skills' user.json
Enter fullscreen mode Exit fullscreen mode

Get an Array Element

jq '.skills[0]' user.json
Enter fullscreen mode Exit fullscreen mode

Output:

"React"
Enter fullscreen mode Exit fullscreen mode

Remember: array indexes start at zero.

Filter an Array of Objects

Imagine you have:

{
  "users": [
    {
      "id": 1,
      "name": "Alex",
      "active": true
    },
    {
      "id": 2,
      "name": "Sam",
      "active": false
    },
    {
      "id": 3,
      "name": "Jordan",
      "active": true
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Find only active users:

jq '.users[] | select(.active == true)' users.json
Enter fullscreen mode Exit fullscreen mode

This is especially useful when inspecting API responses.

Combine curl and jq

Now let's combine two tools.

curl -s https://api.github.com/users/octocat | jq '.login, .public_repos'
Enter fullscreen mode Exit fullscreen mode

Here's what happens:

  1. curl sends an HTTP request.
  2. -s enables silent mode.
  3. The pipe passes the response to jq.
  4. jq extracts the requested properties.

This is a practical example of how small command-line tools work together.

Important: When testing authenticated APIs, avoid placing access tokens directly in shell history or sharing commands that contain credentials.

7. delta: Make Git Diffs Easier to Read

If you work with Git, you've probably used:

git diff
Enter fullscreen mode Exit fullscreen mode

It shows changes between versions of files.

But large diffs can become difficult to read.

delta is a syntax-highlighting pager for Git and other diff output.

It improves the visual presentation of changes.

Installation

Windows:

winget install dandavison.delta
Enter fullscreen mode Exit fullscreen mode

macOS:

brew install git-delta
Enter fullscreen mode Exit fullscreen mode

Ubuntu or Debian:

sudo apt install git-delta
Enter fullscreen mode Exit fullscreen mode

Run delta Directly

You can pipe diff output into delta:

git diff | delta
Enter fullscreen mode Exit fullscreen mode

Configure delta as Git's Pager

Run:

git config --global core.pager delta
Enter fullscreen mode Exit fullscreen mode

Now Git can use delta when displaying supported paged output.

You can inspect the configuration:

git config --global core.pager
Enter fullscreen mode Exit fullscreen mode

What Does delta Improve?

Depending on your configuration and terminal, delta can provide:

  • Syntax highlighting
  • Improved line formatting
  • Better visual separation of changes
  • Easier navigation through large diffs

It's particularly useful when reviewing pull requests and debugging changes.

8. tldr: Learn Commands Through Practical Examples

Traditional manual pages are comprehensive, but sometimes you just want a quick example.

For instance, you remember the command tar, but you don't remember how to extract an archive.

Instead of reading a long manual, you can use tldr.

tldr provides community-maintained practical examples for command-line tools.

Installation

On macOS:

brew install tldr
Enter fullscreen mode Exit fullscreen mode

On Ubuntu or Debian:

sudo apt install tldr
Enter fullscreen mode Exit fullscreen mode

On Windows, you can install a supported client through package managers or use the official project instructions.

View Examples

tldr tar
Enter fullscreen mode Exit fullscreen mode

Or:

tldr grep
Enter fullscreen mode Exit fullscreen mode

You get concise examples showing common ways to use each command.

Why Use tldr?

It's useful when:

  • You know the command but forgot its syntax.
  • You want a practical example quickly.
  • You're learning a new utility.
  • You don't want to search through a lengthy manual.

Remember that tldr is community-maintained. For authoritative behavior and advanced options, consult the command's official documentation or manual.

9. Combining Tools into Real Developer Workflows

Now let's combine several tools to solve practical problems.

Workflow 1: Find a Component in a Large React Project

Imagine you're searching for a component named UserProfile.

fd -e tsx src | fzf
Enter fullscreen mode Exit fullscreen mode

This lets you interactively search TypeScript React files.

Once you know which file you need, search for the component:

rg -n "UserProfile" src/
Enter fullscreen mode Exit fullscreen mode

Then inspect the file:

bat src/components/UserProfile.tsx
Enter fullscreen mode Exit fullscreen mode

You've combined three tools:

  • fd finds files.
  • fzf filters them interactively.
  • rg searches their contents.
  • bat displays the source code.

Workflow 2: Inspect an API Response

curl -s https://api.github.com/users/octocat | jq .
Enter fullscreen mode Exit fullscreen mode

Extract only a few properties:

curl -s https://api.github.com/users/octocat | jq '{login, name, public_repos}'
Enter fullscreen mode Exit fullscreen mode

This makes API debugging much faster.

Workflow 3: Understand a Project's Structure

eza --tree --level=3
Enter fullscreen mode Exit fullscreen mode

This provides a quick overview of the project directory.

Workflow 4: Review Your Git Changes

git diff | delta
Enter fullscreen mode Exit fullscreen mode

Review your changes with improved formatting.

10. Finding Installed Tools on Different Operating Systems

After installing new utilities, you may want to check whether they are available in your terminal.

Here are useful commands.

Linux and macOS

command -v rg
Enter fullscreen mode Exit fullscreen mode

Or:

which rg
Enter fullscreen mode Exit fullscreen mode

PowerShell

Get-Command rg
Enter fullscreen mode Exit fullscreen mode

Windows CMD

where.exe rg
Enter fullscreen mode Exit fullscreen mode

If a command isn't found immediately after installation, you may need to restart your terminal or update your PATH environment variable.

11. A Note About Windows, macOS, and Linux

Not every tool is installed by default.

Also, installation commands and executable names can vary between distributions.

Here are a few things to remember:

  • Windows users can install many of these tools through WinGet or other package managers.
  • macOS users commonly use Homebrew.
  • Linux users can use their distribution's package manager.
  • Some Linux distributions package a utility under a different executable name.
  • PowerShell supports many Unix-inspired tools, but its native commands and pipelines have different behavior.

You don't need to install every tool immediately.

Start with the ones that solve problems you encounter regularly.

12. Practice Exercises

Let's put these tools into practice.

Exercise 1: Search a React Project

  • Install ripgrep.
  • Search for useEffect in your project.
  • Display matching line numbers.
  • Search only .tsx files.

Exercise 2: Explore Files

  • Install fd.
  • Find all TypeScript files.
  • Find all directories.
  • Exclude node_modules.

Exercise 3: Use Interactive Search

  • Install fzf.
  • Combine it with fd.
  • Search through your project's files.
  • Explore the interactive command-history integration.

Exercise 4: Inspect JSON

  • Create a JSON file containing a list of users.
  • Format it using jq.
  • Extract one property.
  • Filter active users.

Exercise 5: Improve Git Diffs

  • Install delta.
  • Configure it as your Git pager.
  • Make a change in a Git repository.
  • Compare the output of git diff before and after configuration.

Exercise 6: Build Your Own Workflow

Combine at least three tools to:

  1. Find a file.
  2. Search its contents.
  3. Display the relevant source code.

Quick Reference

Tool Main purpose Example
rg Search file contents rg "useState"
fd Find files fd -e tsx
fzf Interactive filtering `fd -t f \
{% raw %}bat Read files with highlighting bat App.tsx
eza Improved directory listing eza --tree
jq Process JSON jq '.name' user.json
delta Improved Git diffs `git diff \
{% raw %}tldr Practical command examples tldr tar

What's Next?

You've now discovered a collection of tools that can make everyday development tasks faster, more convenient, and more efficient.

But there's one more step.

What if you could combine these commands into reusable programs?

What if you could automate repetitive tasks, process files in batches, and build your own development utilities?

That's exactly what we'll explore in the next article:

Automate Your Workflow with Shell Scripting.

We'll learn how to write scripts, use variables, work with conditions and loops, process arguments, and automate real development tasks using Bash and PowerShell.

See you in Article 09!

Top comments (0)