find 命令用于在指定目录下查找文件。
语法
find <path> <parameter>-name <file>:按文件名-iname <file>:忽略大小写-type <type>:按文件类型f: 普通文件d: 目录l: 符号链接b: 块设备c: 字符设备
-size ±g<size>:按文件大小+n: 大于 n-n: 小于 nn: 等于 n- 单位:
c: 字节k: KBM: MBG: GB
 
-maxdepth <n>:最大搜索层次-mindepth <n>: 最小搜索层次-exec <command>:对每一个搜索结果执行指定命令-mtime <天数>: 按修改时间查找-atime <天数>: 按访问时间查找-ctime <天数>: 按创建时间查找
使用
对搜索结果执行命令
# 查找当前目录下所有 .md 文件,并执行 ls -al 命令find . -name .md -exec ls -al {} \;{}表示搜索结果的对象,\;:命令结束(\防止转义)-delete:删除