find tool to find files or directories

find tool

The ufind tool is used to find files or directories, recursively find the corresponding files according to preset conditions

——Command format: find directory Condition 1 Option Condition 2…

——Regular conditions

u-type type (f file d directory l shortcut) u-name "document name" u-iname search by name ignore case u-size file size (k, M, G) u-user username u-mtime press Date search (+ means how many days before-means how many days are within)

— Find /root/ -mtime +10 //10 days ago

— Find /root/ -mtime -10 //Within 10 days


The ufind command provides a separate processing result command --exec

——Command format: find .. .. -exec processing command {} \;

uReplace each result with {}, process them one by one, and end ufind /var/log/ -mtime +10 -type f -exec cp {} /opt/ \; #copy ufind /var/log/ -mtime + 10 -type f -exec mv {} /opt/ \; #Mobile ufind /var/log/ -mtime +10 -type f -exec rm {} \; #Delete

 

Guess you like

Origin blog.51cto.com/11614993/2666208