The Problem: When Standard Tools Hit a Wall
I used to waste minutes every day waiting for grep to crawl through massive log files. For years, my workflow relied on the classic find and grep duo. They are dependable and pre-installed everywhere, but they struggle as projects scale. When I began managing 10+ VPS instances with multi-gigabyte logs, these legacy tools started to feel like a bottleneck.
Six months ago, I replaced my search stack with fzf (a command-line fuzzy finder) and ripgrep (a high-performance search tool). Ripgrep (rg) is written in Rust and consistently outperforms GNU grep by leveraging parallelism. Meanwhile, fzf adds an interactive layer that lets you filter results as you type. This combination doesn’t just shave seconds off a search; it completely changes how you navigate a filesystem.
The real advantage lies in fzf’s “fuzzy” logic. You no longer need to memorize exact file paths. Just type a few scattered characters, and fzf narrows down thousands of files instantly. By piping ripgrep’s output into fzf, you create a custom search engine tailored to your terminal.
Installation: Equipping Your Environment
Most modern Linux distributions include these tools in their official repositories. However, I recommend checking your version to ensure you have access to the latest features.
1. Installing Ripgrep (rg)
On Ubuntu or Debian (20.04+), use apt:
sudo apt update
sudo apt install ripgrep
For Fedora or RHEL systems:
sudo dnf install ripgrep
If you’re stuck on an older distribution, you can pull the binary directly from GitHub or use Cargo:
cargo install ripgrep
2. Installing Fzf
While apt works, I prefer the git installation method. It provides the latest version and simplifies setting up shell extensions like auto-completion.
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
Say ‘Yes’ to all prompts during the install. This automatically updates your .bashrc or .zshrc to enable essential shortcuts like CTRL-T (find files) and CTRL-R (search command history).
Configuration: Connecting the Dots
Raw installation is just the start. By default, fzf uses the standard find command to list files. We can do better. We want fzf to use ripgrep because it is faster and automatically respects your .gitignore rules.
Configuring Fzf to Use Ripgrep
Add these lines to your ~/.bashrc or ~/.zshrc file:
# Use ripgrep for finding files to ignore junk and hidden git data
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
This setup ensures that when you hit CTRL-T, you won’t see thousands of internal .git files. However, it will still show important hidden files like .env or .htaccess.
A Powerful “Search and Open” Function
One of my most-used workflows involves searching for a specific string and opening the file at the exact line number. Add this function to your shell config to automate it:
# Find in File (fif): Search text and open in Vim at the right line
fif() {
if [ ! "$#" -gt 0 ]; then return; fi
rg --column --line-number --no-heading --color=always --smart-case -- "$1" | \
fzf --ansi \
--delimiter : \
--preview 'bat --style=numbers --color=always --highlight-line {2} {1} 2>/dev/null || cat {1}' \
--preview-window 'up,60%,border-bottom,+{2}+7/2' \
--bind "enter:become(vim {1} +{2})"
}
Note: This uses bat for syntax-highlighted previews. If you don’t have it, the function falls back to cat.
Improving the UI
The default fzf interface is a bit plain. You can make it more readable by adding a border and a centered layout:
export FZF_DEFAULT_OPTS='--height 45% --layout=reverse --border --color="border:#777777"'
Verification: Measuring the Gains
After reloading your shell (source ~/.bashrc), test the speed. Go to a large project directory—like a monorepo or the Linux kernel source—and trigger CTRL-T. It should feel instantaneous.
Benchmarking the Difference
Numbers speak louder than words. Try running these two commands in a directory with 50,000+ files:
# Standard find
time find . -name "*.c" | wc -l
# Ripgrep
time rg --files -g "*.c" | wc -l
In my tests on an NVMe-based VPS, find took roughly 1.2 seconds, while rg finished in just 0.08 seconds. That is a 15x performance increase.
Practical Tips and Pitfalls
Fzf is powerful, but piping millions of lines into it can still cause a laggy interface. If your terminal hangs, check htop. Usually, the bottleneck is a poorly optimized source command rather than fzf itself.
Watch out for binary files too. Ripgrep ignores them by default, but if you force it to search everything, you might end up with unreadable garbage in your preview window. Always keep --smart-case active in your aliases. This searches case-insensitively unless you specifically type a capital letter.
Adopting these tools removes the friction of navigating a complex filesystem. After six months of use, I find it nearly impossible to go back to a standard shell environment.

