File Operations

updatedb

Update the file name database used by the locate command.

Synopsis

syntax
updatedb [OPTION]...

Examples

Rebuild the locate database
sudo updatedb
Rebuild skipping temp directories
sudo updatedb --prunepaths='/tmp /var/tmp'
Index only /home to a custom database
updatedb --localpaths='/home' --output=home.db

Common options

FlagDescription
--localpathsDirectories to index
--prunepathsDirectories to skip
--outputDatabase file to write
-vVerbose output

About updatedb

The `updatedb` command update the file name database used by the locate command. File operation commands are essential for navigating and managing the Linux filesystem.

They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.

The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man updatedb`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More File Operations Commands

Other commands in the File Operations category

Related tools