YouTip LogoYouTip

Linux Comm Updatedb

# Linux updatedb Command [![Image 3: Linux Command Manual](#) Linux Command Manual](#) The `updatedb` command is used to create or update the database file required by the `slocate`/`locate` command. The execution process of the `updatedb` command is relatively long because it traverses the entire system directory tree during execution and writes all file information into the `slocate`/`locate` database file. **Note:** `slocate` itself has a database that stores information about files and directories in the system. ### Syntax updatedb(Option) ### Parameters * **-o**: Ignore the default database file and use the specified slocate database file; * **-U**: Update the slocate database for the specified directory; * **-v**: Display the detailed execution process. The following example checks for a non-existent file `tutorial.txt`: # locate tutorial.txt # Search for tutorial.txt, no output, indicating the file does not exist# touch ./tutorial.txt # Add the file tutorial.txt# locate tutorial.txt # Search for tutorial.txt again, still no output# updatedb # Update the locate.db database# locate tutorial.txt # Search for tutorial.txt in the database again, the file is found/root/tutorial/tutorial.txt Using the **-U** option allows specifying the directory for which to update the slocate database. updatedb -U /root/tutorial/ [![Image 4: Linux Command Manual](#) Linux Command Manual](#)
← Prop Element PreviouselementsiVue Examples β†’