1locate(1)                   General Commands Manual                  locate(1)
2
3
4

NAME

6       locate - find files by name
7
8

SYNOPSIS

10       locate [OPTION]... PATTERN...
11
12

DESCRIPTION

14       locate  reads  one or more databases prepared by updatedb(8) and writes
15       file names matching at least one of the PATTERNs  to  standard  output,
16       one per line.
17
18       If  --regex is not specified, PATTERNs can contain globbing characters.
19       If any PATTERN contains no globbing characters, locate  behaves  as  if
20       the pattern were *PATTERN*.
21
22       By default, locate does not check whether files found in database still
23       exist.  locate can never report files created  after  the  most  recent
24       update of the relevant database.
25
26

EXIT STATUS

28       locate  exits  with  status  0  if any match was found or if locate was
29       invoked with one of the --limit 0, --help,  --statistics  or  --version
30       options.   If  no  match  was  found  or a fatal error was encountered,
31       locate exits with status 1.
32
33       Errors encountered while reading a database are not fatal, search  con‐
34       tinues in other specified databases, if any.
35
36

OPTIONS

38       -b, --basename
39              Match  only  the base name against the specified patterns.  This
40              is the opposite of --wholename.
41
42
43       -c, --count
44              Instead of writing file names on standard output, write the num‐
45              ber of matching entries only.
46
47
48       -d, --database DBPATH
49              Replace  the  default database with DBPATH.  DBPATH is a :-sepa‐
50              rated list of database file names.  If more than one  --database
51              option  is  specified,  the resulting path is a concatenation of
52              the separate paths.
53
54              An empty database file name is replaced by the default database.
55              A  database file name - refers to the standard input.  Note that
56              a database can be read from the standard input only once.
57
58
59       -e, --existing
60              Print only entries that refer to  files  existing  at  the  time
61              locate is run.
62
63
64       -L, --follow
65              When  checking  whether files exist (if the --existing option is
66              specified), follow trailing symbolic links.  This causes  broken
67              symbolic links to be omitted from the output.
68
69              This  is  the  default  behavior.  The opposite can be specified
70              using --nofollow.
71
72
73       -h, --help
74              Write a summary of the available options to standard output  and
75              exit successfully.
76
77
78       -i, --ignore-case
79              Ignore case distinctions when matching patterns.
80
81
82       -l, --limit, -n LIMIT
83              Exit  successfully  after finding LIMIT entries.  If the --count
84              option is specified, the resulting  count  is  also  limited  to
85              LIMIT.
86
87
88       -m, --mmap
89              Ignored, for compatibility with BSD and GNU locate.
90
91
92       -P, --nofollow, -H
93              When  checking  whether files exist (if the --existing option is
94              specified), do not follow trailing symbolic links.  This  causes
95              broken symbolic links to be reported like other files.
96
97              This is the opposite of --follow.
98
99
100       -0, --null
101              Separate  the  entries  on  output using the ASCII NUL character
102              instead of writing each entry on a separate line.   This  option
103              is  designed  for interoperability with the --null option of GNU
104              xargs(1).
105
106
107       -S, --statistics
108              Write statistics about each read  database  to  standard  output
109              instead of searching for files and exit successfully.
110
111
112       -q, --quiet
113              Write  no  messages  about  errors encountered while reading and
114              processing databases.
115
116
117       -r, --regexp REGEXP
118              Search for a basic regexp REGEXP.  No PATTERNs  are  allowed  if
119              this  option  is used, but this option can be specified multiple
120              times.
121
122
123       --regex
124              Interpret all PATTERNs as extended regexps.
125
126
127       -s, --stdio
128              Ignored, for compatibility with BSD and GNU locate.
129
130
131       -V, --version
132              Write information about the version and  license  of  locate  on
133              standard output and exit successfully.
134
135
136       -w, --wholename
137              Match only the whole path name against the specified patterns.
138
139              This  is  the  default  behavior.  The opposite can be specified
140              using --basename.
141
142

EXAMPLES

144       To search for a file named exactly NAME (not *NAME*), use
145              locate -b '\NAME'
146       Because \ is a globbing character, this disables the implicit  replace‐
147       ment of NAME by *NAME*.
148
149

FILES

151       /var/lib/mlocate/mlocate.db
152              The database searched by default.
153
154

ENVIRONMENT

156       LOCATE_PATH
157              Path  to  additional databases, added after the default database
158              or the databases specified using the --database option.
159
160

NOTES

162       The order in which the requested databases are  processed  is  unspeci‐
163       fied,  which  allows  locate  to reorder the database path for security
164       reasons.
165
166       locate attempts to be compatible to slocate (without the  options  used
167       for  creating  databases)  and  GNU locate, in that order.  This is the
168       reason for the impractical default --follow option and for the  confus‐
169       ing set of --regex and --regexp options.
170
171       The  short  spelling  of  the  -r option is incompatible to GNU locate,
172       where it corresponds to the --regex option.  Use the long option  names
173       to avoid confusion.
174
175       The  LOCATE_PATH  environment variable replaces the default database in
176       BSD and GNU locate, but it is added to other databases in  this  imple‐
177       mentation and slocate.
178
179

AUTHOR

181       Miloslav Trmac <mitr@redhat.com>
182
183

SEE ALSO

185       updatedb(8)
186
187
188
189mlocate                            Jul 2005                          locate(1)
Impressum