FIND pathname [-options] -print | ||||
pathname | ﹣options | 含义 | 例: | [﹣print ﹣exec ﹣ok] |
~表示$HOME .表示当前目录及其子目录/表示在系统根目录下 | ﹣name | 按文件名查找 | find . -name "*.txt" -print | ﹣print 将匹配的文件输出到标准输出; ﹣exec对匹配的文件执行该参数所给的shell命令;命令形式 'command'{} /; |
﹣perm | 文件权限 | find . -perm 775 -print | ||
﹣prune | 可以使find命令不在 当前目录中查找,如果同时使用- depth,该命令被忽略 | find . -path "./aaa" -prune -o -name "*.txt" -prin | ||
﹣user | 文件属主 | find /etc -user uucp -print | ||
﹣group | 文件所属组 | find /etc -group uucp -print | ||
﹣mtime ﹣n +n | 文件更新时间,- n 文件更新至现在n天以内,+ n 文件更新距今n天之外 | find / -mtime -5 -print | ||
﹣nogroup | 无有效所属组 | find /home -nogroup -print | ||
﹣nouser | 无有效属主 | find /home -nouser -print | ||
﹣newer file1 ! -newer File2 | 查找更新时间比文件file1新但比file2旧的文件 | find . -nwer age.awk ! -nnewr belts.awk -ls | ||
﹣type | 某一类型的文件 | find /etc -type l -print | ||
﹣size n[c] | 查找文件长度为n块的文件,带c时表示文件长度为字节 | find . -size +100c -print | ||
﹣depth | 先查当前目录,再查其子目录 | find . -name "*.txt" -depth -print | ||
﹣fstype | 查找位于某一类型的文件系统中的文件 | |||
﹣mount | 查找文件时不跨越文件系统的mount点 | find . -name "*.txt" -mount -print | ||
﹣follow | 如果find遇到符号链接文件,就跟踪至链接所指向的文件 | |||
﹣cpin | 对匹配的文件使用cpio命令,将这些文件备份 | |||