Home  >  Article  >  Operation and Maintenance  >  How to implement fuzzy query using linux find command

How to implement fuzzy query using linux find command

coldplay.xixi
coldplay.xixiOriginal
2021-02-03 13:44:2241584browse

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 "】.

How to implement fuzzy query using linux find command

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

How to implement fuzzy query using linux find command

Tip 2: Find files with specific permissions:

 find /opt -type f  -perm 755

How to implement fuzzy query using linux find command

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)

How to implement fuzzy query using linux find command

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

How to implement fuzzy query using linux find command

Tip 5:Find the directory where the current directory and its subfolders are owned by weblogic

find /opt   -type d  -user weblogic

How to implement fuzzy query using linux find command

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn