wiki/运维/操作系统/Linux/笔记/9.文件查找.md
2025-01-02 10:46:09 +08:00

36 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## find
- -maxdepth最大搜索目录深度
- -mindepth最小搜索目录深度
- -name “文件名称”:根据名称查找
- -iname “”根据文件名和inode查找
- inum 按inode号查找
- -user按属主查找
- -group按数组查找
- -uid按uid查找
- -gid按gid查找
- -type按文件类型查找
- d目录文件
- l符号链接文件
- s套接字文件
- b块设备文件
- c字符设备文件
- p管道文件
- -a
- -o
- -not
- -size根据文件大小查找
- k
- M
- G
-amin<分钟>:查找在指定时间曾被存取过的文件或目录,单位以分钟计算;
-anewer查找其存取时间较指定文件或目录的存取时间更接近现在的文件或目录
-atime<24小时数>查找在指定时间曾被存取过的文件或目录单位以24小时计算
-cmin<分钟>:查找在指定时间之时被更改过的文件或目录;
-cnewer查找其更改时间较指定文件或目录的更改时间更接近现在的文件或目录
-ctime<24小时数>查找在指定时间之时被更改的文件或目录单位以24小时计算
##### 范例1查找2天内创建的文件
```shell
find /var -type f -newermt "2 days ago"
```