locate - Find files by name
find - Search for files in a directory hierarchy
locate
[root@iZ25x8rhe80Z ~]# locate nginx | wc -l
find
[root@iZ25x8rhe80Z ~]# find ~
[root@iZ25x8rhe80Z ~]# find ~ -type f | wc -l
Find files types
filetype | description |
---|---|
b | Block special device file |
c | Character special device file |
d | Directory |
f | Regular file |
l | Symbolic link |
find / -name "*.php" -type f -ctime -20 -size -1M
设置目录或者文件权限
find ./ -type f -exec chmod 644 {} \;
find ./ -type d -exec chmod 755{} \;