Search
locate
Find files by name quickly using a pre-built database index.
Synopsis
syntax
locate [OPTION]... PATTERN...
Examples
Find all paths containing nginx.conf
locate nginx.conf
Case-insensitive search for readme
locate -i readme
Show first 10 Python file matches
locate -l 10 '*.py'
Count JPEG files in database
locate -c '*.jpg'
Common options
| Flag | Description |
|---|---|
| -i | Case-insensitive matching |
| -l | Limit number of results |
| -r | Use basic regex instead of glob |
| -c | Print only count of matches |
| -e | Only show entries that still exist |
About locate
The `locate` command find files by name quickly using a pre-built database index. Search commands help you locate files, text patterns, and executables across the filesystem.
Efficient searching is critical when working with large codebases or troubleshooting system issues. These tools range from simple filename lookups to full regular-expression pattern matching across file contents.
The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man locate`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Search Commands
Other commands in the Search category