File Search

Fast file-name and content search using `fd` and `rg` (ripgrep)

File Search is a community skill for fast file name and content searching, covering fd-based file name matching, ripgrep content search, regex pattern support, recursive directory traversal, and performance-optimized lookups for large codebases and file systems.

What Is This?

Overview

File Search provides high-performance file discovery using fd for name-based searches and ripgrep for content matching. It covers fd-based file name matching that finds files by pattern with glob and regex support, ripgrep content search that locates text within files across entire directory trees, regex pattern support that enables complex matching expressions for both names and content, recursive directory traversal that searches through nested folder structures efficiently, and performance-optimized lookups that handle large codebases and file systems quickly. Both tools respect gitignore rules by default, automatically skipping hidden files and build artifacts without additional configuration. The skill helps developers locate files and content faster than traditional find and grep commands.

Who Should Use This

This skill serves developers working with large codebases needing fast file location, system administrators searching file systems for configuration and log files, and automation scripts requiring efficient file discovery in workflows. It is particularly valuable for teams managing monorepos or multi-language projects where searches must span diverse directory structures.

Why Use It?

Problems It Solves

Traditional find and grep commands are slow and inefficient on large file systems and complex nested directory structures with thousands of files. Locating files by partial name pattern or extension requires remembering complex command-line syntax with obscure flags and options that vary across tools. Content searches across codebases take too long with standard tools when dealing with thousands of files. Developers waste time navigating directory trees manually to find configuration files or code references. ripgrep addresses this by using parallel threading and SIMD-accelerated text matching to deliver results significantly faster than standard grep.

Core Highlights

fd finder locates files by name pattern with glob and regex support. ripgrep searcher finds text content across entire directory trees efficiently. Regex engine enables complex pattern matching for precise file and content discovery. Performance optimizer handles large codebases with minimal latency using parallel processing.

How to Use It?

Basic Usage

fd "config.yaml"
fd "\.py$"
fd "test_.*\.js"

rg "function authenticate"
rg "TODO:" --type python
rg "import.*requests" -g "*.py"

Real-World Examples

fd "test" --extension ts --extension tsx

rg "@app\.route" --type python

rg "process\.env\." --type js --type ts

fd config --extension json --extension yaml --extension toml

rg "password.*=.*\"" --type python --type js

fd --changed-within 1d

rg "deprecated" --type rust -g "!target/*"

Advanced Tips

Use file type filters with ripgrep to restrict searches to specific languages and reduce false matches. Combine fd and rg in shell pipelines to find files by name and then search their contents efficiently. For example, pipe fd output directly into rg using xargs to perform a two-stage search that first isolates relevant files before scanning their contents. Configure ignore files to exclude build directories and dependencies from search results automatically. Adding a project-level .ignore file alongside .gitignore gives precise control over which paths both tools skip during traversal.

When to Use It?

Use Cases

Locate all occurrences of a deprecated API call across a large codebase for refactoring. Find configuration files by extension across nested project directories for environment setup. Search log files for error messages matching specific patterns during debugging sessions. Identify recently modified files within a time window to audit unexpected changes in a production repository.

Related Topics

Command-line tools, file system search, code search, ripgrep, fd utility, grep alternatives, and developer productivity.

Important Notes

Requirements

The fd command-line tool installed and available in system PATH for file name searches. The ripgrep utility installed for high-performance content searching across files. Familiarity with basic regex patterns for constructing effective search expressions.

Usage Recommendations

Do: use file type filters to narrow searches and improve performance and result relevance. Configure gitignore-style exclude patterns to skip build artifacts and dependency directories automatically. Combine tools in pipelines to find files by name and then search their contents in sequence.

Don't: search without type filters when you know the file type since this wastes time on irrelevant files. Ignore search result context lines when debugging since surrounding code provides critical understanding. Run searches on network-mounted drives without considering latency impacts on performance.

Limitations

Both tools require installation and may not be available in restricted or minimal system environments. Very large binary files can slow searches significantly and should be excluded explicitly. Complex regex patterns may match unintended content and require careful testing and refinement.