Korean

locate — Find files by name

Linux / Basic Linux commands / locate.html

Basic Linux commandsOriginalRegistered 2026-10-20T09:00:00+09:00

Finds file paths quickly using a prebuilt database.

Basic Information

Command Namelocate
One-line IntroductionFinds file paths quickly using a prebuilt database.
Provided byplocate or mlocate
Official Documentationhttps://man7.org/linux/man-pages/man1/locate.1.html
Supported Operating SystemsLinux, macOS (separate install), BSD
Installation StatusRequires a package
CategoryLinux basic commands (tags: Linux basic commands (tags: locate, file search, updatedb, plocate))

What is this command?

locate queries a database instead of walking the file system, so it returns paths very quickly. Changes made after the database was built are not reflected.

The database is refreshed by updatedb, usually through a daily timer. If a newly created file is missing, run updatedb or use find.

What problems does it solve?

  • When you know a file name but not its path
  • Searching large file systems quickly
  • Locating configuration files
  • When find feels too heavy

Key features

Fast search

Queries the database and answers immediately.

  • When to use: Finding names across wide trees
  • What you get: It is much faster than find.
  • Limitations: Recent changes may be missing.

Pattern search

Match names with wildcards or regex.

  • When to use: Grouping by extension or prefix
  • What you get: Narrows candidates at once.
  • Limitations: Case sensitivity depends on database settings.

Database refresh

Run updatedb to reflect the current state.

  • When to use: When a just-created file must be found
  • What you get: Search accuracy improves.
  • Limitations: A full refresh is I/O heavy.

Installation and usage

Check whether it is installed

locate --version

sudo apt install plocate # Debian/Ubuntu sudo dnf install mlocate # Fedora

Real-world examples

Find by name

Search by exact file name.

locate nginx.conf | head

Find by pattern

Find by extension.

locate -i '*.service' | head

Refresh the database

Reflect the latest files.

sudo updatedb
locate mynewfile