It took me a weekend to list it. Share it. I hope you can take a few minutes to see it. This is a practical search method in Linux.
Which (find the "execution file") <br/> [root @ localhost Home] # which [-A] command <br/>-: list all commands that can be found, not just the first command name. <br/> example: <br/> [root @ localhost Home] # Which passwd <br/>/usr/bin/passwd <br/> whereis (find a specific file) <br/> [root @ localhost Home] # whereis [-bmsu] file or directory name <br/> [root @ localhost Home] # whereis passwd <br/> passwd: /etc/passwd/usr/bin/passwd/usr/share/man/man5/passwd.5.gz ...... <Br/> locate (search for files) <br/> [root @ localhost Home] # locate filename <br/> [root @ localhost Home] # locate passwd <br/>/lib/security/pam_passedqc.so <br/> /lib/security/pam_unix_passwd.so <br/> ......
These file search methods have the following features:
1. Fast
2. Incomplete search
# The so-called speed is that these commands directly search the file system database. Incomplete Search Means that you may be in the database
# The latest file cannot be found because the query file is not updated. You may also find some deleted files.
Find (powerful and direct search for hard disks) <br/> instance 1: change the content of the past 24 hours (mtime) <br/> [root @ localhost Home] # Find/-mtime 0 <br/> #0: indicates that all modifications made from now until 24 hours ago are listed. <Br/> # Use Find/-mtime 3 if it is within 24 hours three days ago, <br/> # indicates the columns modified between 3*24-4*24 hours before today. <Br/> Example 2: Find the files under/etc. If the file date ratio is/etc/passwd, the new files are listed. <Br/> [root @ localhost Home] # Find/etc-newer/etc/passwd <br/> #-newer is used to identify the new and old relationships between two files. <Br/> instance 3: search for files under/home that belong to Peter <br/> [root @ localhost Home] # Find/home-user Peter <br/> # Find all files of any user in the system. <Br/> instance 4: search for files that do not belong to anyone in the System <br/> [root @ localhost Home] # Find/-nouser <br/> # You can find some messy files. <Br/> instance 5: search for a file named passwd. <Br/> [root @ localhost Home] # Find/-name passwd <br/> # Use-name to search for file names. <Br/> instance 6: Search for files whose attributes are f (common files. <Br/> [root @ localhost Home] # Find/-type F <br/> # It is used for some special file searches. <Br/> instance 7: The search file contains the attributes of SGID, SUID, and sbit. <Br/> [root @ localhost Home] # Find/-Perm + 7000 <br/> #7000 is --- s -- T, which is listed if s or t is included. <Br/> # special use. <Br/> instance 8: Find Files larger than 2 MB in the system. <Br/> [root @ localhost Home] # Find/-size + 2000 K <br/> # The unit is K.