Home/Engineer/Linux / Shell/Practical Modern CLI Tools —…
Linux / ShellBeginnerlinuxmacosripgrepfdfzf

Practical Modern CLI Tools — Speed Up Your Work with ripgrep, fd, fzf, and bat

Compares ripgrep (rg), fd, fzf, and bat with classic tools like grep, find, and cat, covering installation, basic usage, and shell integration. A practical guide to speeding up terminal work with fast search, intuitive syntax, a fuzzy finde

Contents
  1. What Are Modern CLI Tools?
  2. Installation
  3. ripgrep (rg) — Code Search That Replaces grep
  4. fd — File Search That Replaces find
  5. bat — File Viewer That Replaces cat
  6. fzf — Interactive Fuzzy Finder
  7. Shell Integration — Where the Real Speed Comes From
  8. Example Workflows Combining the Tools
  9. Wrap-up

What Are Modern CLI Tools?

grep, find, and cat have been terminal staples for decades. They are still powerful, but their options are finicky, they are slow on large repositories, and their output is crude. Tools recently rewritten in languages like Rust do the same jobs faster, with more sensible defaults, and with nicer output.

Classic toolModern replacementKey difference
greprg (ripgrep)Fast, automatically respects .gitignore, recursion by default
findfdConcise syntax, colored output, fast search
catbatSyntax highlighting, line numbers, Git change markers
(none)fzfInteractive fuzzy finder — combine with other commands

It is better to treat these as complements you reach for first in day-to-day work, rather than as full "replacements" for the classic tools.


Installation

Bash
# macOS (Homebrew)
brew install ripgrep fd fzf bat

# Debian / Ubuntu
sudo apt install ripgrep fd-find bat
# fzf to
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install

# Arch
sudo pacman -S ripgrep fd fzf bat

On Debian/Ubuntu, package name conflicts mean fd is installed as fdfind and bat as batcat. Adding alias fd=fdfind and alias bat=batcat to ~/.bashrc is convenient.


ripgrep (rg) — Code Search That Replaces grep

rg searches directories recursively, automatically excluding .gitignore, .ignore, and hidden files. That makes it a good fit for codebase search with no extra flags.

Bash
# grep method: + + set
grep -rn --color "TODO" .

# rg method:
rg TODO

Commonly used options:

Bash
rg "fetchUser" -t js # JavaScript file (-t )
rg "error" -i # when
rg "config" -g "*.yaml" # glob file
rg "deprecated" -l # file
rg "handler" -A 3 -B 1 # 1, 3
rg "v\\d+\\.\\d+" -o #
rg --hidden --no-ignore "key" # file·when fileto
Itemgrepripgrep (rg)
Recursive searchneeds -rdefault
Respects .gitignorenoautomatic
Speedaveragevery fast (parallel)
File type filternone-t js, -t py
Default outputmonochromecolor and line numbers

fd — File Search That Replaces find

find is highly expressive but verbose. fd makes the most common patterns short and intuitive.

Bash
# find:
find . -type f -name "*.log"

# fd: ( , )
fd "\\.log$"
fd config # config

Commonly used options:

Bash
fd -e log # log (-e)
fd -t f report # file (-t f), -t d
fd -H secret # file (-H)
fd -I node_modules # .gitignore when (-I)
fd pattern src/ #
fd -e tmp -x rm {} # run (-x, find -exec )
Itemfindfd
Default syntaxmust specify -name, -typepattern only
Matchingexact/globpartial match and regex
.gitignorenot respectedautomatically respected
Outputmonochromecolor-coded
Command execution-exec ... \;-x / -X

bat — File Viewer That Replaces cat

bat prints files like cat, but adds syntax highlighting, line numbers, and Git change markers. If the output is longer than the screen, it automatically pipes into a pager (less).

Bash
bat src/app.js # +
bat -p log.txt # plain ( without, cat)
bat -A config.txt # · when when
bat -r 10:30 server.log # 10~30
bat -l yaml deploy.tpl # set

To keep color inside a pipe, use --color=always.

Bash
rg -l "TODO" | xargs bat
Itemcatbat
Syntax highlightingnoneyes
Line numbersonly with -ndefault
Git diff displaynonechange-line markers
Pagingnoneautomatic (less)
Script-friendly outputas-issame with -p

bat is a tool for human reading. If you need plain text in a script or a pipe, use -p (plain) or just cat. Decorative characters mixed into the output can break downstream processing.


fzf — Interactive Fuzzy Finder

fzf is a different kind of tool from the ones above. It is a universal filter that lets you interactively narrow down (fuzzy-match) a list from standard input and pick an item. It shines when you combine it with the output of other commands.

Bash
# file vim
vim $(fzf)

# fd Result fzf bat
fd -t f | fzf --preview 'bat --color=always {}'

# git after
git branch | fzf | xargs git checkout

# quit
ps -ef | fzf | awk '{print $2}' | xargs kill

As you type, it matches even if the substring is scattered; then you pick a candidate with the arrow keys and press Enter.


Shell Integration — Where the Real Speed Comes From

fzf's install script registers shell keybindings and completion. Add the following to ~/.bashrc or ~/.zshrc.

Bash
# bash
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

That enables the following keybindings.

KeyAction
Ctrl-RFuzzy-search command history
Ctrl-TPick a file in the current directory and insert it on the command line
Alt-CFuzzy cd into a subdirectory

Switching fzf's file-search backend to fd makes it faster and also respects .gitignore.

Bash
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DEFAULT_OPTS="--height 40% --reverse --border"

Example of a handy function alias:

Bash
# when rg +
rgf() {
  rg --line-number --no-heading --color=always "${1:-}" |
    fzf --ansi --preview 'bat --color=always {1} --highlight-line {2}'
}

Example Workflows Combining the Tools

Bash
# 1) "deprecated" file , , check
rg -l deprecated | fzf --preview 'bat --color=always {}'

# 2) .log file
fd -e log /var/log | fzf | xargs tail -n 50

# 3)
rg "function " -n | fzf

Wrap-up

ToolReplacesOne-line summary
rggrepFast recursive search that understands .gitignore
fdfindIntuitive file search where you just write a pattern
batcatViewer with syntax highlighting, line numbers, and Git markers
fzf—Fuzzy finder that interactively narrows any list

Each of these four tools is useful on its own, but they are most powerful when combined in a pipeline, as in rg | fzf --preview bat. You do not need to throw away the classic tools. Split the roles: use grep/find/cat when script compatibility and portability matter, and use the modern tools for everyday interactive exploration.

#ripgrep#fd#fzf#bat#cli#productivity
Editorial note

AI tools may assist drafting. Check the evidence in each guide for whether commands were run and which environment was used. Confirm the current docs for your version before applying instructions, and email us about errors. email us

Topic-related official docs (auto-linked · not per-claim sources)Linux man pages ↗

Questions & answers

Ask a question about this guide. We'll review and reply.