The Find command summarizes:
1) Search by name,find/-type f-name ' xiaoyao.txt ', Find and delete:Find/-type f-name ' xiaoyao.txt '-exec rm -f {} \; or:find/-type f-name ' xiaoyao.txt ' |xargs rm-f
2) Find files by modified time, such as last 5 days:Find/-type f-mtime-5,5 days ago:Find/-type F-mtime +5, Specify file:Find/-type f-name ' *.log '-mtime +5
3) Example: Find all in a directory and delete, but there is a file can not be deleted, the name is xiaoyao.txt.
[Email protected]]# find/mnt/python/seminar2/data/-type f!-name "Xiaoyao.txt"-exec rm-f{} \;
4) View the absolute path of the file:[[email protected]]# Find $PWD-nameett.txt
5) Look in the directory under the directory (only find the directory in this directory, not to findthe directory of subdirectories): Find./-maxdepth 1-type D,-maxdepthlevels Indicates the depth of the directory to find, in ...
6) find Middle add -o means or, for example:find./-type d-o-type F, add -and representation and, for example, find./-type d-a Nd-name ' xiaoyao* ' means to find the directory under the current directory and the name is Xiaoyao(do not write and represent and ),! non-such as section 3).
7) Delete method, add parameter-delete later , such as:find/-type f-name ' xiaoyao* ' –delete
8) query system files larger than 100M files :
[[email protected] logs]# Find/-type f-size +100m |XARGSLS-LH
Summary of Find command in Linux system