English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux updatedb Befehl

Linux Command Manual

Der updatedb-Befehl wird verwendet, um slocate zu erstellen oder zu aktualisieren/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 during execution and write all file information to slocate/in the locate database files.

Note:slocate itself has a database that stores relevant information about files and directories in the system.

Syntax

updatedb(Options)

Parameters

  • -o<File>:Ignore the default database file and use the specified slocate database file;
  • -U<Directory>:Update the slocate database of the specified directory;
  • -v:Displays the detailed process of execution.

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 be updated for the slocate database.

updatedb -U /root/w3codebox/

Linux Command Manual