Common:
GREP-NR "keyword" searches for all files in the current directory that match the keyword
Grep-nr "keywords" *php search php files for all matching keywords in the current directory
Find-name ' *.php ' |xargs grep ' hello! ' Search all matching keywords "hello!" in the current directory The PHP file
Replace file contents
Sed-i "s/the original string/string to be replaced/g" ' grep "the original string"-RL path "replaces a segment of all files in a path with a string we want to modify
The grep-i pattern files are not case-sensitive to search. Case sensitive by default
Grep-l pattern files lists only the matching file names
Grep-l pattern Files lists mismatched filenames
Grep-w pattern files Match only the entire word, not part of the string (such as matching ' magic ' instead of ' magical ')
Grep-c number pattern files match the context to display the [number] line respectively
grep pattern1 | PATTERN2 files displays rows that match pattern1 or pattern2
grep pattern1 Files | grep pattern2 shows rows that match both PATTERN1 and pattern2
Find-name april* Find files starting with April in the current directory
Find-name april* Fprint file finds files starting with April in the current directory and outputs the results
Find-name ap*-o-name may* Find files that start with an AP or May
Find/mnt-name tom.txt-ftype vfat to find files with the name Tom.txt and file system type VFAT under/MNT
Find/mnt-name T.txt! -ftype VFAT under/mnt to find files with the name Tom.txt and file system type not VFAT
Find/tmp-name wa*-type L Find a file with a type of symbolic link at/tmp that begins with the name WA
Find/home-mtime-2 in/home search for files that have changed in the last two days
find/home-atime-1 checked files accessed within 1 days
Find/home-mmin +60 The files that were changed 60 minutes ago at/home
Find/home-amin +30 Check the files that were accessed last 30 minutes ago
Xargs with grep lookup: Find-name ' *.php ' |xargs grep ' hello! '
File Search under Linux