1. File Search Command Locate
Locate command format
Locate file name
Search by file name in the background database, search faster
/var/lib/mlocate (depending on the Linux version, the database name is different)
Locate command to search the background database, updated every day database updatedb, only search to (new key files when searched, need updatedb to search in real time)
UpdateDB
Update Database
Linux does not have a locate command to install Yum install mlocate,updatedb before it can be used
/etc/updatedb.conf: Viewing search filter rules
2. Command Search command Whereis and which
Search System Command
-B: Query only executable files
-W: View only where the Help document is located
Which: It also contains aliases, but does not see the corresponding Help document
PATH environment variable: Defines the paths to the System Search command: Echo $PATH
3. File Search command Find
Search for files: find "search scope" "Search criteria"
Avoiding large-scale searches can be very costly to system resources
Find is to search the system for eligible file names. If a match is required, use wildcards to match
Find/-name Install.log
Find/root-iname (case-insensitive search) Install.log
Find/root-user|-nouser Root: Search by Owner
Find/var/log-mtime + 10: Find files modified for 10 days
-10 10 days to modify the file
10 10 days of modified files on the same day
+10 files modified 10 days ago
Atime File access time
CTime changing file properties
Mtime Modifying file contents
Find. -size 25k|-25k|+25k: Find files in the current directory equal to | less than | Larger than |25k size
Find. Inum 26624 Find I node for 26624 file
Find. -size +20k-a-size-50k-exec (processing the result command of the previous search) Ls-lh {}\;
-a:and Logic and
-o:or logic or
{} \; standard format
4. String Search command grep, find&&grep difference
grep [Options] string file name
-I: Ignore case
-V: excludes the specified string
Differences: Inclusion relationships for search results
Find: Searches the system for eligible file names and, if necessary, matches the wildcard characters exactly.
grep: Searches for qualifying strings in a file, matches with regular expressions if required, regular expressions contain matches
linux-File Search Command