Locate files and directories
Format: locate file and directory
We can see that we searched for test5 and output the result to us. We created a new file named newfile1. However, we did not find it when using locate. We may find that we use locate to search very quickly, because a directory database is maintained for us in Linux, the search is performed in the database that has been stored, rather than in the real-time read/write hard disk search. So the speed is very fast, but the database is not always updated, it is a set-time update. We didn't write the data just inserted, so we couldn't find it. We can use the following command.
Updatedb updates or creates a database for the entire system directory file.
Format: updatedb
This command is usually used with the previous command order.
Grep is used to search for words or phrases in the specified mode in the file and display all rows that contain the given string mode on the standard output.
Format: grep [Option] Find mode file name
-E interprets the search mode as an extended regular expression.
-F: The search mode is interpreted as a simple character.
-B displays the position of the row containing matching characters in the file before each row of the output, which is expressed by byte offset.
-I is case insensitive.
-R recursively searches for files in all subdirectories
-N: add the row number before the output contains rows in the matching mode.
Specifically, this is not a file search command.
From: Meng xiangyue's column