locate Command Generator
Generate locate commands to find files by name from a prebuilt database
Getting Started with locate
## What is locate?
`locate` finds files by name using a prebuilt database (maintained by `updatedb`), so searches are nearly instantaneous — far faster than `find`. The trade-off is that results reflect the database, which is usually refreshed once a day, so very recent files may be missing and deleted files may still appear.
## How to Use
1. **Set Options**: Toggle case-insensitivity, count-only, result limit, or use a regex. 2. **Enter Pattern**: Type the file name pattern to search for (glob by default). 3. **Copy & Run**: Paste the generated command into your terminal.
If results look stale, refresh the database with `sudo updatedb`.
Common Options
### Pattern (positional) The file name pattern to match. By default `locate` treats it as a shell glob embedded anywhere in the path, so `locate.conf` matches `/etc/nginx/nginx.conf`.
### `-i` Ignore case Match patterns case-insensitively — `locate -i README` also finds `readme.md` and `Readme.txt`.
### `-c` Count only Print just the number of matching files instead of their names. Useful for quick tallies in scripts.
### `-l N` Limit Cap the number of results at N — e.g. `-l 10` prints at most ten matches, avoiding screen-flooding on broad queries.
### `-r REGEX` Treat as regex Interpret the pattern as a basic regular expression instead of a glob, e.g. `-r '^/etc/.*\.conf$'`.
### `-w` Flexible whitespace Match whitespace in the pattern against any whitespace in file names, useful when names contain spaces.
### `-d DB` Custom database Use the given database file instead of the system default (typically `/var/lib/mlocate/mlocate.db`).
▶What is the difference between locate, whereis, and which?
▶Why does locate show files I just deleted (or miss new ones)?
▶How do I search case-insensitively and limit the output?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee