Tuesday, February 2, 2016

find search for files

find . -exec <command> {}  <\; or + >


{}  =  files found

$ find <path> -exec <command> {} \;

results in:
<command>  <file found name 1>
<command>  <file found name 2>
<command>  <file found name ...>

$ find <path> -exec <command> {} +

results in:
<command>  <file found name 1> <file found name 2> <file found name ...>


Examples:

$ find . -exec grep chrome {} \;

or

$ find . -exec grep chrome {} +


find multiple matchs

-o = "or"
$ find . -name <match1> -o ! -name <match2>
#name = match1  OR  not  ( name = match2 )

-a =  "and"
$ find . -name <match1> -a ! -name <match2>

#name = match1  AND not ( name = match2 )

other find exampleshttp://www.binarytides.com/linux-find-command-examples/

No comments:

Blog Archive