updatedb
Quick Reference
Command Name:
updatedb
Category:
file management
Platform:
linux
Basic Usage:
Common Use Cases
- 1
File database
Update the file database for faster file location
- 2
Performance
Improve the speed of file searches
- 3
System maintenance
Keep the file database up-to-date
- 4
Scripting
Use in shell scripts to update the file database programmatically
Syntax
updatedb [OPTION...]
Options
Option | Description |
---|---|
--localpaths=PATH | Non-network directories to put in the database |
--netpaths=PATH | Network directories to put in the database |
--prunepaths=PATH | Directories to exclude from the database |
--prunefs=FILESYSTEM | Filesystems to exclude from the database |
--output=DBFILE | Database file to build |
--netuser=USER | User to search network directories as |
--dbformat=FORMAT | Database format to use (often 'LOCATE02') |
-v, --verbose | Print paths as they are found |
-h, --help | Display help information |
-V, --version | Display version information |
Examples
How to Use These Examples
The examples below show common ways to use the updatedb
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
sudo updatedb
Update the file name database with default settings. This requires superuser privileges to access all files.
sudo updatedb --prunepaths="/tmp /var/tmp"
Update the database while excluding the /tmp and /var/tmp directories.
sudo updatedb -v
Run with verbose output to show the progress of the database creation.
Advanced Examples:
sudo updatedb --localpaths="/home"
Only index files in the /home directory, ignoring all other locations.
sudo updatedb --output=/path/to/custom/locate.db
Store the database in a custom location instead of the default.
sudo updatedb --netpaths="/mnt/network"
Include network mounted directories like /mnt/network in the database.