Linux find命令

实例

find 路径 查找类型 相应类型
find ./ -name filename 查询当前路径文件
find ./ -name filename1 -o filename2 查找1或2文件
find ./ -name filename ! -ftype vfat 查找文件类型不为vfat的文件

语法

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point…] [expression]

参数

HLP

-D debugoptions

-Olevel

EXPRESSION

POSITIONAL OPTIONS

GLOBAL OPTIONS

TESTS

参数描述
+nfor greater than n,
-nfor less than n,
nfor exactly n.
-amin nFile was last accessed n minutes ago.
-anewer fileFile was last accessed more recently than file was modified.
-atime nFile was last accessed n*24 hours ago.
-cmin nFile’s status was last changed n minutes ago.
-cnewer fileFile’s status was last changed more recently than file was modified.
-ctime nFile’s status was last changed n*24 hours ago.
-emptyFile is empty and is either a regular file or a directory.
-executableMatches files which are executable and directories which are searchable (in a file name resolution sense).
-falseAlways false.
-fstype typeFile is on a filesystem of type type.
-gid nFile’s numeric group ID is n.
-group gnameFile belongs to group gname (numeric group ID allowed).
-ilname patternLike -lname, but the match is case insensitive.
-iname patternLike -name, but the match is case insensitive.
-inum nFile has inode number n.
-ipath patternLike -path. but the match is case insensitive.
-iregex patternLike -regex, but the match is case insensitive.
-links nFile has n links.
-lname patternFile is a symbolic link whose contents match shell pattern pattern.
-mmin nFile’s data was last modified n minutes ago.
-mtime nFile’s data was last modified n*24 hours ago.
-name patternBase of file name (the path with the leading directories removed) matches shell pattern pattern.
-newer fileFile was modified more recently than file.
-newerXY referenceSucceeds if timestamp X of the file being considered is newer than timestamp Y of the file reference.
-nogroupNo group corresponds to file’s numeric group ID.
-nouserNo user corresponds to file’s numeric user ID.
-path patternFile name matches shell pattern pattern.
-perm modeFile’s permission bits are exactly mode (octal or symbolic).
-perm -modeAll of the permission bits mode are set for the file.
-perm /modeAny of the permission bits mode are set for the file.
-readableMatches files which are readable.
-regex patternFile name matches regular expression pattern.
-samefile nameFile refers to the same inode as name.
-size n[cwbkMG]File uses n units of space, rounding up.
-type cFile is of type c
-uid nFile’s numeric user ID is n.
-used nFile was last accessed n days after its status was last changed.
-user unameFile is owned by user uname (numeric user ID allowed).
-writableMatches files which are writable.
-context pattern(SELinux only) Security context of the file matches glob pattern.

ACTION

参数描述
-deleteDelete files; true if removal succeeded.
-exec command ;Execute command; true if 0 status is returned.
-exec command {} +
-execdir command ;
-execdir command {} +
-fls fileTrue; like -ls but write to file like -fprint.
-fprint fileTrue; print the full file name into file file.
-fprint0 filerue; like -print0 but write to file like -fprint.
-fprintf file formatTrue; like -printf but write to file like -fprint.
-lsTrue; list current file in ls -dils format on standard output.
-ok command ;Like -exec but ask the user first.
-okdir command ;Like -execdir but ask the user first in the same way as for -ok.
-printTrue; print the full file name on the standard output, followed by a newline.
-print0True; print the full file name on the standard output, followed by a null character
-printf formatTrue; print format on the standard output, interpreting \' escapes and%’ directives.

OPERATORS

UNUSUAL FILENAMES

STANDARDS CONFORMANCE

参考文献:
http://www.cnblogs.com/wanqieddy/archive/2011/06/09/2076785.html
https://blog.csdn.net/lilygg/article/details/84076757

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值