The locate command is one of the Linux lookup commands. It can be used to find data. It is similar to the find command, but the find command is more resource-consuming. The following small series will give you a detailed description of locate. The usage of the command.
locate allow users to specify the file if there is a very fast file search system. The method is to first create a database that includes all the file names and paths in the system, and then only need to query the database when searching, without actually going deep into the file system. In the general distribution, the creation of the database is automatically performed in the crontab.
1. Command format:
Locate [Select Parameters] [Style]
2. Command function:
The locate command can quickly find the file when searching the database. The database is updated by the updatedb program. The updatedb is periodically created by the cron daemon. The locate command is more than the entire hard disk data when searching for the database. Searching for data is fast, but the worse one is that if the file found by locate is recently established or just renamed, it may not be found. In the default value, updatedb will run once a day, and the set value can be updated by modifying crontab. . (etc/crontab)
locate is used to search for qualified files. It will store the file and directory name in the database to find files or directories that match the style of the template. Special characters can be used. For example, ”*” or ”?” etc. to specify the template style, if the specified template is kcpa*ner, locate will find all files or directories whose starting string is kcpa and ending with ner, such as the name If kcpartner is named kcpa_ner, it will list all files including subdirectories in that directory.
The locate command and find find the file function is similar, but locate is to use the update program to create an index database for all files and directory data in the hard disk, directly find the index when executing loacte, the query speed will Faster, the index database is generally managed by the operating system, but it can also be directly updated to force the system to modify the index database immediately.
3. Command parameters:
-e will be excluded from the scope of the search.
-1 if yes 1. Then start safe mode. In safe mode, users will not see files that they cannot see. This will start to slow down because locate must go to the actual file system to get the file's permission data.
-f Exclude specific file systems, for example, we have no reason to put the files in the proc file system in the database.
-q Quiet mode, no error message will be displayed.
-n Display up to n outputs.
-r Use the regular expression to do the search.
-o Specifies the name of the data library.
-d Specify the path of the database
-h Display the auxiliary message
-V Display the version information of the program
Previous12Next page Total 2 pages
Linux users often use the scp and sftp commands when transferring remote files. How
There are a lot of software that can convert text files into PDF files. In Linux, you can convert te
SVN is a source code version control tool that uses the command line on the server.
Linux multi-threaded programming has the advantages of improving application respon
Linux how to use the whereis command to quickly find the file
What are the differences in the length of 32-bit and 64-bit data types in Linux?
Linux steps to monitor database systems with Zabbix
How to clean up swap, buffer and cache in Linux
How to delete the specified file in swap
Ubuntu 14.04 prohibits the apport error report window startup method
Linux command line daily use technology
What should I do if Linux vi is stuck?
Linux uses PXE to install virtual machines
How to set up PostgreSQL remote access in Linux
PP car rental tenant how to pay PP car rental tenant payment process introduction
In the Win10 system, the method of adjusting the blinking speed of the cursor is
Win7 system double click can not open jar file
How Win8 always displays the menu bar when opening a window
What should I do if win7 is slow?
What is the official version number of Win10?
Linux ends with a keyword process (batch kill process method)
Japanese version of MacBook dual system Windows10 keyboard error solving tutorial