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

( Five ) Find by filename

-name pattern: The file name is pattern Documents of . Note that if pattern Including * When waiting for special symbols , Quotes required .
-iname:name Ignore case versions of .
-lname pattern: Find symbolic connection file named pattern Documents of .
-ilname:lname Ignore case versions of .
be careful : Here pattern 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 path pattern Documents of .
-ipath:path Ignore case versions of .
for example : stay / Find path in directory to /u Starts with SS End of file .
[[email protected] /]# find / -path "/u*SS" /usr/share/groff/1.22.2
/font/devps/SS
( Seven ) Other find , 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 is 512 byte , This is the default unit .
3 . w: with words In units ,words Represents two bytes .
4 . k: with 1024 Byte as unit .
5 . M: with 1048576 Byte as unit .
6 . G: with 1073741824 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 the inode Number search .

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

-samefile name: Find the heel name 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: Common 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