Locate: This Command requires the database indexed in the background to support running. In ubuntu, the database file is located in/var/Cache/locate/locatedb. Generally, this database file is automatically updated through cron every day. If the update is unfortunately not available, you can executeSudo updatedb
To manually update. If I want to find a file named linux.html IN THE SYSTEM, run the following command:Locate linux.html
. The locate search speed is very fast, and the results will be listed later. Locate has a very useful option-R, which allows you to use regular expressions when searching for files.
Find: this is an important file search command in another Linux system. The find command has powerful functions, and is generally used as follows:Find location-name file name
. For example, you can runFind/-name linux.html
. In addition to searching for files by file name, you can also use the-size N option to specify the file size), time (for example,-atime n indicates to search for files accessed n days ago) to search for files. In addition, the find command also supports regular expressions when searching files. You only need to specify the-RegEx option.
For more details, see man locate or man find.