#grep #command-line-tool #format #search #cli

app rfgrep

Recursive file grep utility with advanced filtering - search, list, and analyze text files with regex support

2 releases

Uses new Rust 2024

new 0.1.1 May 24, 2025
0.1.0 May 23, 2025

#320 in Filesystem

30 downloads per month

BSD-3-Clause

27KB
461 lines

rfgrep

A command-line utility for recursively searching and listing files with advanced filtering capabilities. Built in Rust.

CI

Features

  • Advanced Search

    • Regex, plain text, and whole-word matching
    • Recursive directory traversal
    • Binary file detection
    • Extension filtering
    • Size limits
  • File Listing

    • Detailed/simple output formats
    • Extension statistics
    • Size filtering
    • Hidden file handling
  • Utilities

    • Clipboard copy support
    • Dry-run mode
    • Logging to file
    • Progress indicators

Installation

From Source

git clone https://github.com/kh3rld/rfgrep.git
cd rfgrep
cargo install --path .

Via Cargo

cargo install rfgrep

Usage

rfgrep search "pattern"

Search with Options

rfgrep search "pattern" \
    --mode regex \
    --extensions rs,toml \
    --max-size 5 \
    --skip-binary \
    --copy

File Listing

# Simple list
rfgrep list

# Detailed view
rfgrep list --long --recursive

# With filters
rfgrep list --extensions rs,toml --max-size 10 --show-hidden

Command Reference

Global Options

Option Description
--log PATH Write logs to specified file
--path DIR Base directory (default: .)

Search Command

Option Description
--mode MODE Search mode: regex/text/word
--extensions EXT Comma-separated file extensions
--max-size MB Skip files larger than specified MB
--skip-binary Skip binary files
--dry-run Preview files without processing
--copy Copy results to clipboard

List Command

Option Description
--extensions EXT Comma-separated file extensions
--long Detailed output format
--recursive Recursive directory traversal
--show-hidden Include hidden files/directories
--max-size MB Skip files larger than specified MB
--skip-binary Skip binary files

Examples

  1. Find all Rust files containing "HashMap":
rfgrep search "HashMap" --extensions rs
  1. List all Markdown files under 1MB:
rfgrep list --extensions md --max-size 1
  1. Search with regex and copy to clipboard:
rfgrep search "fn\s+\w+\s*\(" --mode regex --copy

Performance Tips

  • Use --skip-binary to avoid unnecessary file checks
  • Limit scope with --extensions and --max-size
  • For large directories, --dry-run first to preview

Contributing

Contributions are welcome! Please open an issue or PR for any:

  • Bug reports
  • Feature requests
  • Performance improvements

Dependencies

~9–23MB
~355K SLoC