Find common commands (find cascade copy, or delete)

1, find find files cascading replication cp
-t parameter specifies the destination directory, -f general file
[root @ k8smaster yum] # the Find / var / Cache / yum / The -type f -name '* RPM' | xargs cp -t / home / zhaiky / rpm /

2, look for files larger than the 100M
-size file size, -n smaller than the file size n, + n n is greater than the size of the file
find ./ -size + 100M # clean the disk when large files Find

3, mtime how many days the modified file
+ n represents n other than the file modification day, n represents exactly n days modified file, -n expressed within n days modified file
find / var / log -type f -mtime +7 # Find files seven days before

4, mmin how many minutes modified files
+ n represents n other than the file modification minutes, -n expressed within n minutes modified file
find / var / log -type f -mmin +7 # 7 minutes before lookup file

5, find find files cascading deletes RM
the Find / the Data / log -name '* .log' -mtime +7 -exec RM -f \; # will be under / data / log / directory for files ending in .log, and change deletion time more than 7 days
find / data / log -type f -exec ls {} \;

Published 60 original articles · won praise 20 · views 4609

Guess you like

Origin blog.csdn.net/zhaikaiyun/article/details/104396336