Linux updatedb Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux updatedb Guide
Complete beginner-friendly guide to updatedb on Linux, covering Arch Linux, CachyOS, and other distributions including updating locate database, database configuration, and search index management.
Table of Contents
Understanding updatedb
What is updatedb?
updatedb updates locate database.
Uses:
- Update database: Refresh file index
- Rebuild index: Recreate search database
- Maintain search: Keep locate working
- System maintenance: Maintain file index
Why it matters:
- Search accuracy: Keep search current
- New files: Index new files
- System maintenance: Regular updates needed
updatedb Basics
Update Database
Basic usage:
# Update database
sudo updatedb
# Rebuilds locate database
Verbose Output
Show progress:
# Verbose mode
sudo updatedb -v
# -v = verbose (shows progress)
Database Configuration
Configuration File
Edit config:
# Edit config
sudo vim /etc/updatedb.conf
# Configure paths to index
Exclude Paths
Skip directories:
# In /etc/updatedb.conf
PRUNEPATHS="/tmp /var/tmp /var/cache"
PRUNEFS="NFS nfs nfs4"
⏰ Scheduled Updates
Automatic Updates
Systemd timer:
# Check timer
systemctl status updatedb.timer
# Enable timer
sudo systemctl enable updatedb.timer
Manual Update
Force update:
# Update now
sudo updatedb
# Or via systemd
sudo systemctl start updatedb.service
Troubleshooting
updatedb Errors
Check permissions:
# Verify sudo access
sudo -v
# Check database location
ls -la /var/lib/mlocate/
Summary
This guide covered updatedb usage, database updates, and configuration for Arch Linux, CachyOS, and other distributions.
Next Steps
- locate Guide - File searching
- find Guide - Advanced searching
- updatedb Documentation:
man updatedb
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.