Home > Article > Operation and Maintenance > How to implement fuzzy query using linux find command
The method of using the linux find command to implement fuzzy query: According to the fuzzy query of the file name, find the file with the suffix [.log] in the opt directory. The code is [find /opt/ -type f -name "*.log "】.
The operating environment of this tutorial: windows7 system, linux7.3 version, DELL G3 computer. This method is suitable for all brands of computers.
Linux find command method to implement fuzzy query:
Tip 1: Fuzzy query based on file name: Find the suffix .log in the opt directory The file
find /opt/ -type f -name "*.log"
-type f represents the file
-type d represents the matching directory
Tip 2: Find files with specific permissions:
find /opt -type f -perm 755
Tip 3: Find large files: (for example, find files larger than 100M in the opt directory)
find /opt/ -size +100M
-size: represents the file size,
+ represents greater than a certain number,
- represents less than a certain number.
c means the unit is bytes, you can replace c with k, M, G.
(Note: This method can quickly locate large files when the disk space is large)
Tip 4: Search based on time
find /opt -mtime -10
-------Files modified within 10 days (10 before 10 days -10 within 10 days)
Visited using amin , use mmin for modifications, use cmin for file status changes
Use amin, mmin, cmin to be accurate to minutes, use atime, mtime, ctime to be accurate to days
Tip 5:Find the directory where the current directory and its subfolders are owned by weblogic
find /opt -type d -user weblogic
Related learning recommendations:linux video tutorial
The above is the detailed content of How to implement fuzzy query using linux find command. For more information, please follow other related articles on the PHP Chinese website!