Name

locate

Synopsis

locate [options] pattern

Search database(s) of filenames and print matches. Matches include all files that contain pattern unless pattern includes metacharacters, in which case locate requires an exact match. *, ?, [, and ] are treated specially; / and . are not. Searches are conducted against a database of system contents that is updated periodically. To update the database, use the updatedb command.

Options

-b, --basename

Look only at the basename when searching for matches.

-c, --count

List only the match count, not the individual filenames.

-d path, --database=path

Search databases in path. path must be a colon-separated list.

-h, --help

Print a help message and then exit.

-i, --ignore-case

Ignore case when performing matches.

-q, --quiet

Run quietly, printing no error messages.

-r regexp, --regexp regexp

Search for a basic regular expression, with no patterns allowed. May be issued more than once.

--regex

Treat all patterns as extended regular expressions.

-S, --statistics

Print statistics about each database and then exit.

-V, --version

Print version information and then exit.

-w, --wholename

Look at the entire pathname when searching for matches (the default).

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.