Linux Learning: Using File Finder

  
        This time, record the following commands such as locate, find format, common options, and their use cases.
Features of wlocate and find commands
The locate and find commands are used to find files or directories. But obviously locate search speed is much faster than find, because locate does not need to search for a specific directory, but search for a database file. In general, the Linux system will record all the files in the system in a database file. The Linux system automatically creates this database and automatically updates it once a day, so sometimes you will find that using locate will find the files that have been deleted. ! The latest changed files will not be found.
The find command is to find the hard disk directly, which is time consuming.
1. Locate command
is used to find files or directories. It is a non-real-time lookup tool that relies on pre-built indexes rather than searching directly on the file system. Find fast, fuzzy search.
The data that Locate looks for is found by the data in the created database /var/lib/mlocate. This database is updated once a day, so when you find the file after creating a new file, locate will tell you “ Could not find ”! Because the database must be updated.
Manually read the /etc/updated.conf settings through the updatedb command to find the file name in the system hard disk and update the database file in /var/lib/mlocate.
Locate records the name of the keyword file entered by the user based on the database in /var/lib/mlocate.
Finding files and directories Locate command format:
locate [OPTION]... PATTERN...
OPTION:
-i Ignore case
-r can display the display of regular expressions Way
[root@www tmp]# locate -r 'pwd$'
Copyright © Windows knowledge All Rights Reserved