One, locate command to find files
The locate command is to search by file name in the background database, the search speed is fast, non-real-time.
1. Install mlocate
yum -y install mlocate
2. Update the database
updatedb
3. Find files
locate ifcfg-eth0
Two, whereis and which
1、whereis
whereis find command path and help file
whereis -b cmd // return command path
whereis -m cmd // return the help file path
2、which
which cmd returns the command path
Three, Find to find files
1. Basic syntax of find command
find path option expression action
Find according to file size
// Find files with a file size greater than 5M in the /etc directory
find /etc/ -size +5M
Find according to the file type
// Find the block device file in the /dev directory
find /dev -type b
Find according to time
//Find files 7 days ago in the user's home directory
According to the user search
// Find the file in the centos home directory
find /home/centos -user centosFind according to permissions
// Find 755 permission files
find ./shell_scripts/ -perm 755 -ls
2. Find processing action
-print: print the found content (default)
-ls : print the found content in a long format display
-delete: delete the found file (only empty directories can be deleted)
-ok: followed by a custom Shell command ( Will prompt whether to operate)
-exec: followed by a custom Shell command (standard writing -exec \;)