7.2 Invoking locate
locate [option...] pattern...
--basename
-b
- The specified pattern is matched against just the last component of
the name of the file in the locate database. This last component is
also called the “base name”. For example, the base name of
/tmp/mystuff/foo.old.c is foo.old.c. If the pattern
contains metacharacters, it must match the base name exactly. If not,
it must match part of the base name.
--count
-c
- Instead of printing the matched filenames, just print the total
number of matches we found.
--database=
path-d
path- Instead of searching the default file name database, search the file
name databases in path, which is a colon-separated list of
database file names. You can also use the environment variable
LOCATE_PATH
to set the list of database files to search. The
option overrides the environment variable if both are used. Empty
elements in path (that is, a leading or trailing colon, or two
colons in a row) are taken to stand for the default database.
--existing
-e
- Only print out such names which currently exist (instead of such names
which existed when the database was created). Note that this may slow
down the program a lot, if there are many matches in the database.
The way in which broken symbolic links are treated is affected by the
-L, -P and -H options.
--follow
-L
- If testing for the existence of files (with the -e option),
omit broken symbolic links. This is the default.
--nofollow
-P
-H
- If testing for the existence of files (with the -e option),
treat broken symbolic links count as if they were exiting files. The
-H form of this option is provided purely for similarity with
find
; the use of -P is recommended over -H.
--ignore-case
-i
- Ignore case distinctions in both the pattern and the file names.
--limit=N
-l N
- Limit the number of results printed to N. If you use the
--count option, the value printed will never be larger than
this limit.
--mmap
-m
- Accepted but does nothing. The option is supported only to provide
compatibility with BSD's
locate
.
--null
-0
- Results are separated with the ASCII NUL character rather than the
newline character. To get the full benefit of the use of this option,
use the new locate database format (that is the default anyway).
--wholename
-w
- The specified pattern is matched against the whole name of the file in
the locate database. If the pattern contains metacharacters, it must
match exactly. If not, it must match part of the whole file name.
This is the default behaviour.
--regex
-r
- Instead of using substring or shell glob matching, the pattern
specified on the command line is understood to be a POSIX extended
regular expression. Filenames from the locate database which match
the specified regular expression are printed (or counted). If the
-i flag is also given, matching is case-insensitive. Matches
are performed against the whole path name, and so by default a
pathname will be matched if any part of it matches the specified
regular expression. The regular expression may use ^ or
$ to anchor a match at the beginning or end of a pathname.
--stdio
-s
- Accepted but does nothing. The option is supported only to provide
compatibility with BSD's
locate
.
--statistics
-S
- Print some summary information for each locate database. No search is
performed.
--help
- Print a summary of the options to
locate
and exit.
--version
- Print the version number of
locate
and exit.