File Search Command
1. File Search command
Find
2. Other File search commands
grep-Searches the file for string-matched rows and outputs
Locate-Find a file in the file repository
Whereis-Search for the directory where the command is located and the Help document path
Which-search for the directory and alias information of the command
=====================================================================================
1. File Search command Find
use fewer searches and plan the location of your files. Windows Search has a gadget everything, very handy
there are many matching conditions:
-name Search by file name
find/etc-name init search for files named init in/etc directory
find/etc-name *init* Search/etc Directory file name contains init files (*, matches any character)
find/etc-name init??? search/etc directory with a file name beginning with three characters after Init (? , match one character)
-iname case-insensitive Search by file name
find/etc-iname Init???
-size based on file size
Find/-size +204800 finds files larger than 100M in the root directory
+n greater than-n less than n equals
1k= two data blocks all 100m=100*1024kb=204800 blocks of data
data block is the smallest storage unit of Linux, 512 bytes (0.5k)
-user based on owner lookup
Find/home-user Admin Find the file owner admin in the root directory
-group based on the owning group
find/etc-cmin-5 Find files and directories with properties modified within 5 minutes under/etc
-5 Five minutes, +5 five minutes later
-amin accessing time access
-cmin file attribute change
-mmin File Contents Modify
find/etc size +163840-a-size-204800
find files larger than 80MB and less than 100MB in/etc
- a two conditions simultaneously satisfy
- o two conditions to meet any one of the
find/etc-name-exec ls-l {} \;
find inittal files and monitor details under/etc
-exec/-ok Command {} \; Perform actions on search results
--------------------------------------------------------------------------------------------------------------- ----------------------------------------
1.locate for newly created files, if not included in the mlocate.db, this time will be updatedb
2./tmp temporary storage file directory is not included in the locate range
3.locate-i Case insensitive
GREP-V #/etc/inittab out all the lines that exist #
Grep-v ^#/etc/inittab The lines at the beginning of the line are removed
Linux Learning Note 2-command Summary 3