find
查找文件或目录
find 查找范围 查找条件
| | |
---|
-name | 按名称查找 | |
-maxdepth | 查看多深的文件,不能超过所限制的目录下的内容 | |
-mindepth | 查看不小于多深的文件,不低于所限制内容 | |
-not | 非 | |
-o | 或 | |
-a | 和 | |
-user | 查找属于某用户的文件 | |
-group | 查找属于某用户组的文件 | |
-size | 按文件大小查找 | |
-atime | access time | 按访问时间查找文件 |
-mtime | modify time | 按修改时间查找文件 |
-ctime | change time | 按状态修改时间查找文件 |
-perm | 按权限查找 | |
#!/bin/bash
find /etc/ -name "*.conf"
find /etc/ -maxdepth 4 -name "*.conf"
find /etc/ -maxdepth 1 -name "*.conf"
find /etc/ -user user1
find /etc/ -user user1 -o -user user2
find /etc/ -size 1M
find /etc/ -size -1M
find /etc/ -size +1M
find /etc/ -atime 7
find /etc/ -atime +7
find /etc/ -atime -7
find /etc/ -mtime 7
find /etc/ -mtime +7
find /etc/ -mtime -7
find /etc/ -ctime 7
find /etc/ -ctime +7
find /etc/ -ctime -7
find /etc/ -perm 666
find /etc/ -perm -666
find /etc/ -perm /666
计算机英语