The find directive is one of the most important operating instructions under Linux and is used for file tree species lookups (possibly accessing the disk) for relevant processing.
First we should set up several files ourselves (mkdir command), then we carry on the classification analysis;
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/6F/wKiom1dBdOCDeLmGAAA26U-RsKc786.png "title=" Picture 1.png "alt=" Wkiom1dbdocdelmgaaa26u-rskc786.png "/>
1. find-name by file name or regular expression
1) Find ./-name test.c//Find test.c file
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/6D/wKioL1dBdfPCRHWHAAAPe6F3msU603.png "title=" Picture 2.png "alt=" Wkiol1dbdfpcrhwhaaape6f3msu603.png "/>
2) find./-name ' test* ' //Find the file name that contains test
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/6F/wKiom1dBdRvA6r1eAAAaCd7z1rU623.png "title=" Picture 3.png "alt=" Wkiom1dbdrva6r1eaaaacd7z1ru623.png "/>
Regular expressions
in the Find command "! " to negate the argument.
Find./!-name ' *.c ' //Find files that are not. C.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/6D/wKioL1dBdiORH6S6AAAh9ddElI0452.png "title=" Picture 4.png "alt=" Wkiol1dbdiorh6s6aaah9ddeli0452.png "/>
2. Find by File size
-size N:[c] finds files with a file length of n blocks, with C indicating the length of the file in bytes.
b--block (512 bytes); c--byte; w--Word (2 bytes);
k--kilobytes; m--megabytes; g--gigabytes.
1) find./~-size +200k//file greater than 200k
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/80/6F/wKiom1dBdUuR0YkPAAA5xpQNkP8983.png "title=" Picture 5.png "alt=" Wkiom1dbduur0ykpaaa5xpqnkp8983.png "/>
2) Find ~-size-200k//files less than 200k
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/6F/wKiom1dBdWTTQ21SAAATqSVCXr4535.png "title=" Picture 6.png "alt=" Wkiom1dbdwttq21saaatqsvcxr4535.png "/>
3 . According to File Type locate the file.
-type find a file of a certain type. Such as:
file Type type parameter
normal file F
symbol File L
Catalog D
character device C
Block Device B
Socket S
Pipe file P
Find. -type d Find Files directory
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/6F/wKiom1dBdYPhP2t9AAAbhEHFOvg594.png "title=" Picture 7.png "alt=" Wkiom1dbdyphp2t9aaabhehfovg594.png "/>
4. Find by file time
Each file in a Linux file system has three timestamps:
(1) Access Time (-atime): The last time the user visited the file;
(2) Modification Time (-mtime): The time the file content was last modified.
(3) Change Time (-ctime): The time the file metadata (metadata, such as permissions or ownership) was last changed.
-atime,-mtime,-ctime as the time parameter, the unit is day. You can use + to represent greater than,-represent less than (and the same as +,-based on file size lookups).
1) Find /-mtime-2//Search for files modified within two days
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/80/6F/wKiom1dBdaCDWvzoAAAaLC3ZZno566.png "title=" Picture 8.png "alt=" Wkiom1dbdacdwvzoaaaalc3zzno566.png "/>
2) find./-newer test.c // find a new file than test.c
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/80/6F/wKiom1dBdbrCtoCuAAAasYA8QaI262.png "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" spacer.gif "height=" 134 "width=" 483 "title=" Picture 9.png "/>
in the There are many command commands under the Find command, which I will not enumerate.
The Find command operation under Linux system