Linux search to find classes find, locate, grep and pipe |

1.find : Find files in the specified directory
Note : Any string before the parameter will be regarded as the directory name to be found. If you use this command without setting any parameters, the find command will search for subdirectories and files in the current directory. And display all found subdirectories and files

Syntax: find path -option [ -print ] [ -exec -ok command ] {} \ ;

parameter significance
-name <query method> Find files according to the specified file name search method (wildcards are applicable)
-user<username> Find all files belonging to a specified user
-size <file size> Find by specified file size

write picture description here
write picture description here
2.locate : Quickly locate the file path

locate utilizes the pre-established locate database of all file names and paths in the system to quickly locate a given file. locate does not traverse the entire file system, and the query speed is faster, but the administrator must regularly update the locate time.
Note: Before the first execution, you must use the updatedb command to create a locate database

Syntax: locate [-d ][–help][–version][template style…]

Example:
write picture description here
3 grep and the pipe character |
grep filter and search; the pipe character "|" means to hand over the processing result of the previous command to the following command for processing.

grep parameter meaning
-n show line number
-i not case sensitive

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324736541&siteId=291194637