How to Install ripgrep on Ubuntu: The Fastest Way to Search Your Code
ripgrep, invoked as rg, recursively searches a directory tree for a regex pattern and does it fast enough that searching a whole repository stops feeling like an operation you have to plan. It is written in Rust, and it has become the tool a great many developers reach for instead of grep -r.
Speed is only half the story. ripgrep respects .gitignore, skips hidden and binary files, filters by language, and produces output that is pleasant to read and easy to pipe into something else. It is also the search engine embedded in VS Code, Neovim’s Telescope and Helix, so you may already be using it without knowing.
Ubuntu carries ripgrep in the archive, but each release pins a version and keeps it, while upstream continues to land performance work, new flags and better Unicode support. The archive build also links against the system PCRE2.
The unofficial deb.griffo.io repository packages the upstream release as a proper Ubuntu .deb: a statically linked musl binary with PCRE2 compiled in, no runtime library dependencies, and upgrades delivered by APT along with everything else.
Install the Latest ripgrep on Ubuntu: The Short Version
If you only came for the commands, this adds the repository and installs the latest ripgrep .deb package on Ubuntu:
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
sudo apt update
sudo apt install ripgrep
The rest of this guide explains what each command does, how to verify the install, how to keep ripgrep up to date, and what to check when something goes wrong.
What Makes ripgrep Special?
- ⚡ Extremely fast - Parallel traversal plus a finite automata regex engine with heavy literal optimisation beats grep and ack on most real trees.
- 🙈 Smart filtering by default -
.gitignore,.ignoreand.rgignoreare honoured, hidden files and binaries skipped, so you get signal instead of noise. - 🗂️ File type filters -
rg -tpyorrg -Tjsonscope a search to a language without hand-written globs. - 🌍 First-class Unicode - UTF-8, character classes and case folding handled correctly by default.
- 🔎 PCRE2 when you need it -
-Penables look-around and backreferences, compiled into this build. - 🔁 Multiline and replace -
-Ucrosses line boundaries,-rrewrites matches in the output. - 🤖 Machine-readable output -
--jsonemits structured events for editors and scripts. - 📦 Single static binary - Nothing else to install, nothing to keep in sync.
Why Use the deb.griffo.io Repository?
- A current ripgrep instead of the version frozen into your Ubuntu release.
- Easy installation and updates through APT, with no cargo build and no manual tarballs.
- PCRE2 compiled in, so
-Pworks with no extra packages. - Static musl build with no shared library dependencies at runtime.
- Works across supported Ubuntu releases, with the codename detected for you.
Prerequisites
Before starting, confirm you have:
- An Ubuntu system (Jammy 22.04 LTS, Noble 24.04 LTS, or newer)
sudoprivilegescurlinstalled (sudo apt install curlif needed)
Step 1: Add the deb.griffo.io Repository
Register the key and repository source:
# Create the keyrings directory
sudo install -d -m 0755 /etc/apt/keyrings
# Download and install the repository GPG key
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
# Add the repository (auto-detects your distro codename)
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null
# Update the package list
sudo apt update
Breaking it down:
- Create the keyrings directory - makes sure
/etc/apt/keyringsexists with the right permissions. - Install the GPG key - downloads and de-armours the repository key into its own keyring so APT can verify signatures.
- Add the repository - writes a
signed-bysource line, lettinglsb_release -scfill in your Ubuntu codename. - Update the package list - refreshes APT’s view of available packages.
Step 2: Update the Package List
If you did not run the final command above, do it now:
sudo apt update
Step 3: Install ripgrep
Install with APT:
sudo apt install ripgrep
Since deb.griffo.io offers a higher version than the Ubuntu archive, APT picks it automatically. If ripgrep is already installed from the archive, this upgrades it in place.
Step 4: Verify the Installation
The binary is rg. Check the version:
rg --version
You should see something like:
ripgrep 15.2.0
features:+pcre2
The +pcre2 line confirms rg -P is available. Use apt policy ripgrep to see which repository supplied it, and man rg for the full manual.
Getting Started with ripgrep
Everyday Searching
# Search the current directory tree for a pattern
rg "TODO"
# Case-insensitive search
rg -i "connectionstring"
# Smart case: insensitive unless the pattern contains uppercase
rg -S "Handler"
# Whole words only, treating the pattern as a fixed string
rg -w -F "user_id"
Recursion is the default, and anything your .gitignore excludes stays out of the results.
Narrowing by File Type and Glob
# Only Python files
rg -tpy "def main"
# Everything except JSON
rg -Tjson "version"
# Globs, including negation
rg "migrations" -g '*.cs' -g '!**/obj/**'
# List every type ripgrep knows
rg --type-list
Context, Counts and File Lists
# Three lines of context around each match
rg -C3 "panic!"
# Only the names of matching files
rg -l "IDisposable"
# Count matches per file
rg -c "await "
# The files ripgrep would search, without searching them
rg --files
That last one is a fast, gitignore-aware file lister, which makes it an ideal feed for fzf:
rg --files | fzf
Searching What ripgrep Normally Skips
# Include hidden files
rg --hidden "api_key"
# Ignore .gitignore rules
rg --no-ignore "generated"
# Unrestricted: hidden, ignored and binary files too
rg -uuu "magic-string"
Advanced Patterns
# Look-around and backreferences through PCRE2
rg -P '(?<=class )\w+' -tcs
# Multiline matching across line boundaries
rg -U 'BEGIN;[\s\S]*?COMMIT;'
# Capture groups and replacement in the output
rg -r '$1' '"version":\s*"([^"]+)"'
# Structured events for tooling
rg --json "error" | head
Making It Yours
ripgrep reads default flags from the file named by RIPGREP_CONFIG_PATH:
# ~/.config/ripgrep/ripgreprc
--smart-case
--hidden
--glob=!.git/*
--max-columns=180
--max-columns-preview
# Add this to ~/.bashrc or ~/.zshrc
export RIPGREP_CONFIG_PATH="$HOME/.config/ripgrep/ripgreprc"
Shell Completions
Completions for bash, zsh and fish ship with the package, in /usr/share/bash-completion/completions/rg, /usr/share/zsh/vendor-completions/_rg and /usr/share/fish/vendor_completions.d/rg.fish. Open a new shell and rg --ty<TAB> will complete.
Keeping ripgrep Updated
ripgrep now rides along with your usual Ubuntu upgrades:
sudo apt update && sudo apt upgrade
When a newer ripgrep lands in deb.griffo.io, apt upgrade installs it with your other packages.
Other Tools from deb.griffo.io
The repository includes plenty of tools that sit well beside ripgrep:
- fzf - a general-purpose fuzzy finder that pairs perfectly with
rg --files. - eza - a modern replacement for
ls. - Neovim - the hyperextensible Vim-based editor, whose live grep is ripgrep.
- Helix - a post-modern modal editor with ripgrep-powered global search.
Troubleshooting
GPG or Key Errors
If APT flags the repository as unsigned or the key as invalid, re-import it:
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update
Package Not Found
If APT cannot locate ripgrep:
- Re-run
sudo apt updateafter adding the repository. - Verify your Ubuntu release is supported (Jammy, Noble, or newer).
- Check the source list:
cat /etc/apt/sources.list.d/deb.griffo.io.list.
APT Chose the Ubuntu Archive Version
Look at the candidates:
apt policy ripgrep
If the archive version is preferred, pin the repository one explicitly:
sudo apt install ripgrep=15.2.0-1~noble
Use whichever version string apt policy shows for deb.griffo.io on your release.
A Snap or Cargo Build Shadows the Package
Older cargo install ripgrep builds live in ~/.cargo/bin and can win the PATH race:
which -a rg
Remove the stray copy with cargo uninstall ripgrep, or reorder your PATH so /usr/bin/rg comes first.
-P Says PCRE2 Is Unavailable
The rg on your PATH is then not this build. rg --version should list +pcre2; if it does not, check which -a rg and remove or reorder the other copy.
Uninstalling
Remove ripgrep with:
sudo apt remove ripgrep
To also remove the repository and key:
sudo rm /etc/apt/sources.list.d/deb.griffo.io.list
sudo rm /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update
Conclusion
ripgrep repays the two minutes it takes to install almost immediately. Searching a large repository becomes instant, the defaults keep node_modules and build output out of your results without any configuration, and the same tool drives search inside your editor.
Installing it from deb.griffo.io on Ubuntu gives you a current, PCRE2-enabled, dependency-free build, kept up to date by the package manager you already run.
Frequently Asked Questions
How do I install the latest ripgrep on Ubuntu?
Add the deb.griffo.io APT repository and its signing key, then run sudo apt install ripgrep. The repository tracks upstream ripgrep releases, so you get the latest packaged version rather than a build frozen when your distribution was released.
Is there a .deb package for ripgrep?
Yes. deb.griffo.io publishes ripgrep as a signed .deb for Ubuntu. You could download that .deb and install it by hand, but adding the repository is the better option: APT then resolves dependencies and picks up new versions on its own.
How do I update ripgrep to the latest version?
Run sudo apt update && sudo apt upgrade. Once ripgrep is installed from APT there is no separate updater to remember, since new releases arrive with the rest of your system updates.
How do I install ripgrep on Debian?
Exactly the same way; lsb_release -sc simply resolves to a different codename. There is a companion guide with the Debian specifics: How to install ripgrep on Debian.
Which Ubuntu releases are supported?
Jammy 22.04 LTS, Noble 24.04 LTS and newer. Because the repository line is built from lsb_release -sc, the matching suite is selected for you.
Resources
- ripgrep GitHub Repository
- ripgrep User Guide
- ripgrep FAQ
- deb.griffo.io Repository
- Install guide on deb.griffo.io
Disclaimer: The deb.griffo.io repository is an unofficial community project and is not affiliated with the official Debian or Ubuntu projects, or with the upstream ripgrep project.