1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| - name 查找/etc目录下以conf结尾的文件 find /etc -name '*conf' , - iname 查找当前目录下文件名为aa的文件,不区分大小写” find . -iname aa -user 查找文件属主为hdfs的所有文件 find . -user lyhcc -group 查找文件属组为yarn的所有文件 find . -group mysql -type f 文件 find . -type f d 目录 find . -type d c 字符设备文件 find . -type c b 块设备文件 find . -type b l 链接文件 find . -type 1 p 管道文件 find . -type P -size -n 大小大于n的文件 +n 大小小于n的文件
例子1:查找/etc目录下小于10000字节的文件 find /ete -size -10000c 例子2:香找/ete目录下大干1M的文件 find /etc -size +1M -mtime -n n天以内修改的文件 +n n天以外修改的文件 n 正好n天修改的文件 例子1:查找/etc目录下5天之内修改且以conf结尾的文件find /etc -mtime -5 -name '*.conf' 例子2:查找/etc目录下10天之前修改且属主为root的文件 find /etc -mtime +10 -user root -mmin -n n分钟以内修改的文件 +n n分钟以外修改的文件 例子1:查找/etc目录下30分钟之前修改的文件 find /etc -mmin +30 例子2:查找/etc目录下30分钟之内修改的目录 find /etc -mmin -30 -type d -mindepth n 表示从n级子目录开始搜索 例子:在/etc下的3级子目录开始搜索 find /etc -mindepth 3 -maxdepth n 表示最多搜索到n级子目录 例子1:在/etc下搜索符合条件的文件,但最多搜索到2级子目录find /etc -maxdepth 3 -name "文件条件" 例子2: find ./etc/ -type f -name "*.conf" -size +10k -maxdepth 2
|