finding-files

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

fd: Intuitive File Search

fd:直观的文件搜索

Always invoke fd skill for fast file discovery - do not execute bash commands directly.
Use fd for fast file discovery that's 13-23x faster than find.
如需快速查找文件,请始终调用fd技能——不要直接执行bash命令。
使用fd进行快速文件查找,速度比find快13-23倍。

Default Strategy

默认策略

Invoke fd skill for fast file discovery with parallel search and smart defaults. Use when searching for files by name, pattern, or type, especially when performance matters or when working with large directories.
Common workflow: fd skill → other skills (fzf, bat, ripgrep, sd) for further processing.
调用fd技能,通过并行搜索和智能默认设置实现快速文件查找。当你需要按名称、模式或类型搜索文件时,尤其是对性能有要求或处理大型目录时,可使用此技能。
常见工作流:fd技能 → 其他技能(fzf、bat、ripgrep、sd)进行后续处理。

Key Options

关键选项

  • -e ext
    for extension filtering
  • -t file|dir
    for type filtering
  • -H
    include hidden files
  • -I
    ignore .gitignore
  • --exclude pattern
    exclusions
  • -x
    exec per file,
    -X
    exec batch
  • {}
    ,
    {.}
    ,
    {/}
    placeholders
  • -e ext
    用于扩展名过滤
  • -t file|dir
    用于类型过滤
  • -H
    包含隐藏文件
  • -I
    忽略.gitignore规则
  • --exclude pattern
    排除指定模式的文件
  • -x
    对每个文件执行命令,
    -X
    批量执行命令
  • {}
    ,
    {.}
    ,
    {/}
    占位符

When to Use

使用场景

  • Quick file searches by pattern
  • Filter by type, size, extension
  • Search with depth limits
  • Batch file operations
  • Integration with other tools
  • 按模式快速搜索文件
  • 按类型、大小、扩展名过滤
  • 按深度限制搜索
  • 批量文件操作
  • 与其他工具集成

Common Workflows

常见工作流

  • fd → fzf → bat
    : Search files, select interactively, view with syntax highlighting
  • fd → sd
    : Find files and perform batch replacements
  • fd → xargs tool
    : Execute commands on found files
  • fd → ripgrep
    : Search within specific file types
  • fd → fzf → bat
    :搜索文件、交互式选择、带语法高亮查看
  • fd → sd
    :查找文件并执行批量替换
  • fd → xargs tool
    :对找到的文件执行命令
  • fd → ripgrep
    :在特定文件类型内搜索内容

Core Principle

核心原则

Smart defaults: ignores hidden/.gitignore files, case-insensitive, parallel search - much faster than find.
智能默认设置:忽略隐藏文件/.gitignore中的文件、不区分大小写、并行搜索——比find快得多。

Detailed Reference

详细参考

For comprehensive search patterns, filtering options, execution examples, and performance tips, load fd guide when needing:
  • Advanced filtering patterns (size, time, depth)
  • Batch execution with placeholders
  • Performance optimization techniques
  • Integration with shell scripts
  • Complex exclusion patterns
The guide includes:
  • Core search patterns and file discovery
  • Extension and type filtering techniques
  • Execution and batch operation examples
  • Performance optimization strategies
  • Integration with other tools (xargs, ripgrep)
  • Advanced filtering and exclusion patterns
如需了解全面的搜索模式、过滤选项、执行示例和性能技巧,可加载fd指南,适用于以下场景:
  • 高级过滤模式(大小、时间、深度)
  • 使用占位符进行批量执行
  • 性能优化技巧
  • 与shell脚本集成
  • 复杂的排除模式
该指南包含:
  • 核心搜索模式与文件查找
  • 扩展名和类型过滤技巧
  • 执行与批量操作示例
  • 性能优化策略
  • 与其他工具(xargs、ripgrep)的集成
  • 高级过滤与排除模式

Skill Combinations

技能组合

For Discovery Phase

发现阶段

  • fd → fzf: Interactive file selection with preview
  • fd → ripgrep: Search within specific file types
  • fd → jq/yq: Extract data from found config files
  • fd → extracting-code-structure: Get structure overview of found files
  • fd → fzf:带预览的交互式文件选择
  • fd → ripgrep:在特定文件类型内搜索内容
  • fd → jq/yq:从找到的配置文件中提取数据
  • fd → extracting-code-structure:获取找到文件的结构概览

For Analysis Phase

分析阶段

  • fd → bat: View found files with syntax highlighting
  • fd → tokei: Get statistics for specific file sets
  • fd → jq/yq: Analyze configuration files in directory
  • fd → bat:带语法高亮查看找到的文件
  • fd → tokei:获取特定文件集的统计信息
  • fd → jq/yq:分析目录中的配置文件

For Refactoring Phase

重构阶段

  • fd → sd: Perform batch replacements across found files
  • fd → analyzing-code-structure: Apply structural changes to specific file types
  • fd → xargs: Execute commands on found files
  • fd → sd:对找到的文件执行批量替换
  • fd → analyzing-code-structure:对特定文件类型应用结构更改
  • fd → xargs:对找到的文件执行命令

Integration Examples

集成示例

bash
undefined
bash
undefined

Find and edit source files

Find and edit source files

fd -e py | fzf --multi --preview="bat --color=always {}" | xargs vim
fd -e py | fzf --multi --preview="bat --color=always {}" | xargs vim

Find and replace in JavaScript files

Find and replace in JavaScript files

fd -e js -x sd "oldPattern" "newPattern"
fd -e js -x sd "oldPattern" "newPattern"