rfgrep
A command-line utility for recursively searching and listing files with advanced filtering capabilities. Built in Rust.
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
Assuming you have Rust installed, run:
Via Cargo
From GitHub
From Source
Installing Man Pages
After installing rfgrep, you can install the comprehensive man pages:
System-wide Installation (requires sudo)
User Installation (no sudo required)
Then add to your shell profile (.bashrc, .zshrc, etc.):
Installing Shell Completions
rfgrep supports tab completion for all major shells:
Bash
# Generate and source completion
Zsh
# Generate completion file
# Add to .zshrc
&&
Fish
# Generate and install
PowerShell
# Generate and import
Usage
Basic Search
Search with Options
File Listing
# Simple list
# Detailed view
# With filters
Documentation
Man Pages
After installation, comprehensive man pages are available:
# Main man page
# Command-specific man pages
The man pages include:
- Complete command reference
- Detailed option descriptions
- Practical examples
- Performance tips
- Troubleshooting guides
Shell Completions
Once installed, tab completion provides:
- Command completion (
rfgrep <TAB>) - Option completion (
rfgrep search --<TAB>) - Extension completion (
--extensions <TAB>) - File path completion (
src/<TAB>)
Troubleshooting
Man Pages Not Found
# Check if man pages are installed
# Add to shell profile if needed
Completions Not Working
# Regenerate completions
# Reload shell configuration
# For zsh, ensure completion directory exists
# For fish, install to user directory
Performance Issues
# Use dry-run to preview
# Skip binary files
# Limit file size
# Use specific extensions
Shell-Specific Troubleshooting
Bash:
# Check if completion is loaded
|
# Manual installation
Zsh:
# Check completion directory
# Reload completions
&&
Fish:
# Check if completion is installed
# Manual installation
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
- Find all Rust files containing "HashMap":
- List all Markdown files under 1MB:
- Search with regex and copy to clipboard:
Performance Tips
- Use
--skip-binaryto avoid unnecessary file checks - Limit scope with
--extensionsand--max-size - For large directories,
--dry-runfirst to preview
Advanced Usage
Interactive Mode
# Start interactive search
# Interactive search with specific algorithm
# Interactive search in specific file types
Output Formats
# JSON output for programmatic processing
# XML output for structured data
# HTML output for web display
# Markdown output for documentation
Search Algorithms
# Boyer-Moore (fast for plain text)
# Regular expression
# Simple linear search
Verification
Test Man Pages
# Verify man pages are accessible
Test Shell Completions
# Bash: Type 'rfgrep ' and press TAB
# Zsh: Type 'rfgrep ' and press TAB
# Fish: Type 'rfgrep ' and press TAB
Test Basic Functionality
# Test search functionality
# Test list functionality
# Test interactive mode
Automated Testing
# Test shell completions
# Test man pages
Contributing
Contributions are welcome! Please open an issue or PR for any:
- Bug reports
- Feature requests
- Performance improvements