您的位置:首页 > 运维架构 > Linux

linux command - find

2015-08-23 00:10 411 查看
find
belongs to GNU Findutils which also includes
locate
,
updatedb
,
xargs
.

Function

Search for files in a directory hierarchy.

Snopsis

[code]find [path...] [expression]


Expression

An expression is made up of options, tests and actions, all separated by operators.

Numeric arguments

+n
for greater than n,

-n
for less than n,

n
for exactly n.

tests

-name
,
-iname


-path
,
-ipath


-regex
,
-iregex


-type


d
, directory

f
, regular file

l
, symbolic link

-size
n[ckMG]

c
, byte

actions

-print
, this is the default action

-delete


-exec
command
;


{}
represents the file matched

-exec
command
{} +


operators

Describe logical relationship between tests.

-and
, this is default when omitted. shortened
-a


-or
, shortened
-o


-not
, shortened
-!


()
, note to escape with
\


Warning

wildcards and special symbols must be quoted or escaped

Double quotes do not suppress the substitution of words that begin with “$” but they do suppress the expansion of wildcard characters.

use
-print0
with
xargs -0
for executing commands

Notes

find -exec cmd {} + vs | xargs

What is the difference between find . and find . -print
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: