#whereis [Options] [command name] feature: The path where the search command resides and its help document location
Options:-B get command location only;-M get help document location only
#which [command name]
Function: Search the path and alias of the command
#locate [FileName]
Function: In the background database "/var/lib/mlocate", search by filename
Note: 1, locate to include matching;
2, the corresponding background database is not updated in real time, so the recently generated files can not be searched;
3, #updatedb命令可以实时更新数据库
Whereis which locate these three commands, following the search rules specified by the configuration file/etc/updatedb.conf:
#find [Search in] [search conditions]
Function: Within specified range, search for files that meet specified criteria
Option:-name Search by filename (exact match);
-iname Search by filename (exact match), case-insensitive;
-user Search by file owner;
-nouser search for files without owner
#find/var/log/-mtime +10 Search log directory 10 days ago Last modified content file
#find/var/log/-ctime-10 searches the log directory for the last 10 days to change the properties of the file
#find/var/log/-atime 10 searches the log directory for the last file accessed 10 days in the same day
#find/var/log/-size 25k Search log directory file size equal to 25k files
#find/var/log/-size +25m search for files with a file size greater than 25M in the log directory
#find/var/log/-size-25k Search Log directory file size less than 25k files----k lowercase, M caps, the default unit is the data block (512 bytes)
#find. -inum 262422 searches for files in the current directory where I node is 262422
#find/var/log/\ (-size +5k-a-size-100k \)
Search for files with a file size greater than 5k below 100k in the log directory
#find/var/log/\ (-name "*.log"-a \ (-mtime-1-o-mtime +5 \) \)-----a "and"; -O "or"
Search for files with the file name ending with ". Log" in the log directory, and the last modified time is not within 1-5 days
#find. -name "file*"-exec Ls-ilh {} \;
Searches for files with file names beginning with "File" in the previous directory and displays the details of the file
#find/var/log/-name "an*"-o-name "*.log"-ok rm-rf {} \;
Search the log directory for files that start with "an" or End with ". Log", and then ask before deleting
#grep [Options] [strings] [filename]
Function: Searches the specified file for the specified string and prints the line containing the string (including matching)
Options:-I ignores case,-V excludes the specified string