1. Locate: Locate [Option] keyword Query the files matching the search criteria in the file database. Option: -I: Whether the search is case sensitive. The default value is case insensitive; -N x : Display only before X Matching items; Note: * The file database is used by administrators. Updatedb Otherwise, the newly created files cannot be found. Generally, the database automatically creates updates in the background. * Search for full paths, not just file names. 2. Find: Find [directory…] [Condition……] It is slower than the locate command, but more accurate; * If no directory is specified, query in the current directory; * If no conditions are specified, all conditions are matched. You can run the following command on the file: select-OK or-exec. 1. Basic conditions: 1) -Name File Name: Find the matching file name;
2) -User User name: search by user name; -UID User ID: search by uid; 3) -Group Group Name: search by group name; 2. Conditional logical operations: The and quick connector is used by default for search conditions; Find/-name Ook-user RedHat is a file that meets the requirement that the file name is ook and belongs to the RedHat user. 1) -O To perform or operations; 2) -Not : Logical non-operation:
3. Permission-related search :-Perm [+/-] digital permission 1) + Digital permission : Indicates that at least one character is met; 2) -Digital permission : Indicates that all digits match: 4. Search by file size :-Size [+/-] File Size Find-size 1024 K The file size is exactly 1 MB. Find-size + 1024 K file size greater than 1 mfind-size-1024 K The file size is smaller than 1 MB. 5. Search by access time: -Atime The last read time; -Mtime Last modification time of file data; -Ctime File status change time;-atime-mtime-ctime unit: Days If you want Minutes Can be written -Amin-mmin-Cmin Find-mmin-10 search for files with a modification date of less than 10 days; 6 And find file processing: 1 ) -OK : Confirm when executing the command; 2) -Exec : No confirmation is required to directly execute the command. Remarks: {} Indicates the file name found; Space and \; Indicates termination. Of course, the find command has many combinations. Article This gives you more familiarity with the use of find and more combinations.