Like finding a keyword in all of the PHP files underneath the current directory.
| The code is as follows |
Copy Code |
Find./-name "*.php" | xargs grep ' keyword ' |
If you need to find something that contains special symbols, such as $, and so on, grep adds parameters
| The code is as follows |
Copy Code |
Find./-name "*.php" | Xargs grep-f ' key word ' |
File name Lookup
File Name Lookup method:
For example, if we know that a file contains 3 letters of SRM, it is possible to find all files containing these 3 letters in the system, and enter:
| The code is as follows |
Copy Code |
Find/etc-name ' *srm* ' |
This command indicates that the Linux system will look for all files containing 3 letters of SRM, such as ABSRMYZ,TIBC.SRM and so on, in the entire directory of/ETC to display the eligible files. If you also know that this file starts with the 3-letter SRM, we can also omit the front asterisk, which commands the following:
| The code is as follows |
Copy Code |
Find/etc-name ' srm* ' |
Some other references
Find-name april* finds files starting with April in the current directory
Find-name april* fprint file finds files in the current directory that start with April, and outputs the results to the
Find-nam E ap*-o-name may* find files that begin with AP or May
Find/mnt-name tom.txt-ftype vfat Find files with/mnt file system type Tom.txt under VFAT
Find/mnt -name T.txt! -ftype VFAT Find a file with the name Tom.txt under/MNT and the file system type is not VFAT
Find/tmp-name wa* L Find the file named WA beginning with the type Symbolic link in/tmp
-type Time-2 under/home for files that have been altered in the last two days.
Find/home-atime-1 Search for files accessed within 1 days
Find/home-mmin +60 Check for files changed 60 minutes ago in/home
find/h Ome-amin +30 Check the file that was accessed the last 30 minutes ago