⚡ fsearch — Fast File Search & Duplicate Finder
A blazingly fast, cross-platform library and CLI tool for:
- 🔍 Searching files by name (glob) or content (in-file grep)
- 🔁 Finding duplicate files — by content hash, name, or size
📦 Features
| Feature | Detail |
|---|---|
| ⚡ Two search engines | Method 1: parallel walkdir + rayon; Method 2: deterministic recursive |
| 📄 Content search | grep-style search inside files with line numbers |
| 🔁 Finding duplicate files — by content hash, name, or size | |
| 🎨 True-colour output | Every colour is a configurable #RRGGBB hex value |
| 🔍 Glob patterns | * and ? wildcards for file names and -i filters |
| 📁 Depth control | Limit recursion with -d |
| 🚫 Binary-safe | Auto-skips binary files; graceful permission handling |
| ⚙️ Config file | ~/.config/fsearch/config.toml or ./fsearch.toml |
| 🧵 Parallel search | Rayon thread pool (configurable thread count) |
| 🛑 Ctrl-C clean exit | Exits with code 130 |
| 🪟 Cross-platform | Linux · macOS · Windows |
📦 Installation
CLI binary
Library dependency
# Cargo.toml
[]
= "1.1"
Pre-built binaries
Download from GitHub Releases:
| Platform | File |
|---|---|
| Linux x86_64 (glibc) | fsearch-linux-x86_64.tar.gz |
| Linux aarch64 | fsearch-linux-aarch64.tar.gz |
| Linux x86_64 (musl/static) | fsearch-linux-x86_64-musl.tar.gz |
| macOS x86_64 | fsearch-macos-x86_64.tar.gz |
| macOS Apple Silicon | fsearch-macos-aarch64.tar.gz |
| Windows x86_64 | fsearch-windows-x86_64.zip |
From source
# binary → ./target/release/fsearch (or fsearch.exe on Windows)
🔧 Usage
fsearch <SUBCOMMAND> [OPTIONS]
Subcommands:
find 🔍 Search files by name or content
dup 🔁 Find duplicate files
config ⚙️ Configuration helpers
fsearch find
# Find all Rust files (depth 5)
# Search file contents for "TODO" in Python/TS files
# Case-sensitive name search
# Search in a specific directory, verbose
fsearch dup
# Content duplicates (default — exact byte match via SHA-256)
# Same filename in different directories
# Same size (fast but imprecise)
# Use MD5, only images, files >= 100 KiB
# Skip binary files, limit to 20 groups
Options
| Flag | Description | Default |
|---|---|---|
PATTERN |
Pattern to search (* ? wildcards supported) |
— |
-m, --method <1|2> |
Engine: 1 = walkdir+rayon, 2 = recursive | 1 |
-c, --case-insensitive |
Case-insensitive matching | on |
-C, --case-sensitive |
Case-sensitive matching | off |
-d, --deep <N> |
Maximum directory depth | 1 |
-p, --path <DIR> |
Search root directory | . |
-D, --no-dir |
Exclude directories from results | off |
-f, --file |
Search inside file contents | off |
-i, --include <GLOBS> |
Include only files matching patterns (CSV) | all |
-x, --exclude <DIRS> |
Extra directory names to skip (CSV) | — |
-n, --max-results <N> |
Limit results (0 = unlimited) | 0 |
-v, --verbose |
Print status, filters and elapsed time | off |
--init-config |
Write default config to ~/.config/fsearch/config.toml |
— |
--show-config |
Print active config as TOML and exit | — |
💡 Examples
# Find all Rust source files (depth 5)
# Find files containing "TODO" in Python/JS/TS source
# Case-sensitive search for exact name
# Search in a specific directory, verbose output
# Exclude extra dirs on top of defaults
# Limit to first 20 results
# Generate your config file
# Inspect active config
fsearch config
📚 Library usage
Add to Cargo.toml:
[]
= "1.1"
File search
use ;
use ;
let opts = builder
.base_dir
.max_depth
.case_insensitive
.build;
let interrupted = new;
let results = fast_find?;
for m in &results
Content search
use ;
use SearchMatch;
use ;
let opts = builder
.base_dir
.max_depth
.search_in_files
.include_patterns
.build;
let interrupted = new;
let results = fast_find?;
for m in &results
Duplicate detection
use ;
use ;
let opts = builder
.max_depth
.mode
.algorithm
.min_size // skip files < 1 KiB
.skip_binary
.build;
let interrupted = new;
let = find_duplicates?;
println!;
for group in &groups
⚙️ Configuration
# → ~/.config/fsearch/config.toml
Config lookup order (highest priority first):
./fsearch.toml— project-local override~/.config/fsearch/config.toml— user config- Built-in defaults
See fsearch.toml.example for all available keys with documentation.
All config keys
# Search behaviour
= 1 # default -d value
= 1 # 1 or 2
= true
= true
= 1024
= 10000
= 0 # 0 = all logical CPUs
# Output
= false
= false
= false
= 0 # 0 = unlimited
# Colours — any CSS hex string
= "#FF88FF"
= "#FFFF00"
= "#FF4444"
= "#00FFFF"
= "#FFFFFF"
= "#00FFFF"
= "#FF3333"
= "#FFAA00"
= "#00FF88"
= "#FF00FF"
# Filters
= ".git,node_modules,.svn,__pycache__,.hg,target,.cache"
= "" # e.g. "*.py,*.rs"
📊 Exit Codes
| Code | Meaning |
|---|---|
0 |
One or more matches found |
1 |
No matches found, or error |
130 |
Interrupted by Ctrl-C |
🏗️ Building for Windows from Linux
# Install rustup (https://rustup.rs), then:
# Uncomment the [target.x86_64-pc-windows-gnu] block in .cargo/config.toml, then:
# → target/x86_64-pc-windows-gnu/release/fsearch.exe
Or simply push a version tag — GitHub Actions builds all platforms automatically.
🤝 Contributing
- Fork & create a feature branch
- Ensure
cargo clippy -- -D warningsandcargo testboth pass - Open a pull request
📄 License
MIT — see LICENSE
👤 Author
Hadi Cahyadi — cumulus13@gmail.com
GitHub: @cumulus13
