Skip to main content

Locate Documentation

A comprehensive guide to locate — the fastest file-finding utility on Linux. Unlike find, which reads the live filesystem, locate queries a pre-built database and returns results in milliseconds.

Mental model: locate is a search engine for your filesystem. The database is the index, updatedb is the crawler, and locate is the query interface.

Where locate Fits​

ToolSpeedAccuracyFilters
findMedium100% real-timeMetadata (size, perms, time)
locateInstantStale by up to 24hPath substring only
fdFast100% real-timeName, type, time, size

Use locate when: you want instant results and don't care about files created in the last 24 hours.

Curriculum​

1. Introduction​

2. Installation & Setup​

3. Core Searching​

4. Database Management​

  • Updatedb — Manual updates, cron scheduling, and database location.
  • Excluding Paths — /etc/updatedb.conf configuration.

5. Advanced Filtering​

6. Scripting & Pipelines​

7. Real World Workflows​

8. Troubleshooting​

9. Cheatsheet​


Quick Start
# Install and initialize
sudo apt install mlocate && sudo updatedb

# Search instantly
locate nginx.conf # find by substring
locate -i "readme" # case insensitive
locate -b "\nginx.conf" # basename exact match
locate -e "*.log" | head -20 # only show files that exist