In the previous article, I have alreadyfind The basic usage of the command is introduced in detail, Now let's move on to morefind Command usage scenarios.

( Five) Find by filename

-name pattern: File name ispattern Documents. Notice ifpattern Include* When waiting for special symbols, Quotes required.
-iname:name Ignore case versions of.
-lname pattern: Find symbolic connection file namedpattern Documents.
-ilname:lname Ignore case versions of.
Be careful: Herepattern Represents the name of the file being searched.
[[email protected] /]# find / -name "geekdevops.*" [[email protected] /]
# find / -iname "geekdevops.*" /root/GeekDevOps.txt /root/GeekDevOps.doc
/root/GeekDevOps.docx /root/GeekDevOps.wps /home/GeekDevOps/GeekDevOps.doc
/home/GeekDevOps/GeekDevOps.txt /home/GeekDevOps/GeekDevOps.pdf
/home/GeekDevOps/GeekDevOps.bpm /home/GeekDevOps/GeekDevOps.wps
( Six) Find by path

-path pattern: Find the file name based on the full pathpattern Documents.
-ipath:path Ignore case versions of.
for example: stay/ Find path in directory to/u Starts withSS End of file.
[[email protected] /]# find / -path "/u*SS" /usr/share/groff/1.22.2
/font/devps/SS
( Seven) Other search, matching( Need to understand, memory)

-regex pattern: Matching file names with regular expressions.
-iregex:regex Ignore case versions of.
-empty: The file is empty and is a normal file or directory.
-size n[cwbkMG]: Specify file length find file. Unit selection bit:
1 . c: Byte unit.
2 . b: Block as unit, Block size is512 byte, This is the default unit.
3 . w: withwords As a unit,words Represents two bytes.
4 . k: with1024 Byte as unit.
5 . M: with1048576 Byte as unit.
6 . G: with1073741824 Byte temperature unit.

n You can also use the+- Number as prefix. Meaning is similar to time, Indicates less than found(-) File of specified length or greater than(+) File of specified length.

-inum: According to theinode Number lookup.

-links n: Find based on the number of file connections.

-samefile name: Find and followname The specified file is exactly the same file, That is to say, the two files are hardwired.

-type c: Find files by file type:
c The types that can be selected are:
1 . b: Block device.
2 . c: Character device.
3 . d: Catalog.
4 . p: name pipes.
5 . f: Ordinary documents.
6 . l: Symbolic connection.
7 . s:socket.
[[email protected] /]# find / -size +10M -a -size -50M -type f
/boot/initramfs-0-rescue-9cf4b87196734d8a98541aef198335a8.img /boot/initramfs-
3.10.0-693.el7.x86_64.img find: ‘/proc/8600/task/8600/fdinfo/6’: There is no file or directory find:
‘/proc/8600/fdinfo/6’: There is no file or directory /var/lib/rpm/Packages /var/cache/yum/x86_64/7
/base/gen/primary_db.sqlite /var/cache/yum/x86_64/7/updates/gen/primary_db
.sqlite /usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/lto1
/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/cc1plus