fd is a program to find entries in your filesytem. It is a simple, fast and user-friendly alternative to find.

用法

快速入门

查找当前目录的文件名中包含字符串 hello 的项目:

  1. fd hello

正则匹配以 vi 开头的文件:

  1. fd '^vi'

指定在相对路径 test 中搜索:

  1. fd '^vi' test

列出所有 png 图片:

  1. fd -e png

列出所有名字包含 hellopng 图片:

  1. fd -e png hello

稍微进阶

对所有搜索到文件执行某种操作

  1. fd . /mnt/documents -e txt -x echo {/}

-x对每个搜索项执行命令,其中:

  1. {} path
  2. {/} basename
  3. {//} parent directory
  4. {.} path without file extension
  5. {/.} basename without file extension