English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The updatedb command is used to create or update slocate/the database file required by the locate command.
The execution process of the updatedb command is relatively long, because it will traverse the entire directory tree of the system when executing, and write all file information to slocate/in the locate database file.
Note:slocate itself has a database that stores relevant information about files and directories in the system.
updatedb(Options)
The following examples detect a non-existent file w3codebox.txt:
# locate w3codebox.txt # Search for w3codebox.txt, no output, indicating that the file does not exist # touch ./w3codebox.txt # Add file w3codebox.txt # locate w3codebox.txt # Search for w again3codebox.txt, the file is still not found # updatedb # Update locate.db database # locate w3codebox.txt # Database search for w again3codebox.txt, find the file /root/w3codebox/w3codebox.txt
Use -U The option can specify the directory to update the slocate database.
updatedb -U /root/w3codebox/