1 .\" Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
2 .\" Copyright (c) 1990, 1993
3 .\" The Regents of the University of California. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)locate.1 8.1 (Berkeley) 6/6/93
41 .Nd find filenames quickly
51 program searches a database for all pathnames which match the specified
53 The database is recomputed periodically (usually weekly or daily),
54 and contains the pathnames
55 of all files which are publicly accessible.
57 Shell globbing and quoting characters
66 although they will have to be escaped from the shell.
67 Preceding any character with a backslash
69 eliminates any special
70 meaning which it may have.
71 The matching differs in that no characters must be matched explicitly,
75 As a special case, a pattern containing no globbing characters
77 is matched as though it were
80 Historically, locate only stored characters between 32 and 127.
82 current implementation store any character except newline
87 The 8-bit character support does not waste extra space for
88 plain ASCII file names.
89 Characters less than 32 or greater than 127
90 are stored in 2 bytes.
92 The following options are available:
95 Print pathnames separated by an
98 character (character code 0) instead of default NL
99 (newline, character code 10).
101 Print some statistics about the database and exit.
103 Suppress normal output; instead print a count of matching file names.
107 instead of the default file name database.
113 option adds the specified database to the list
114 of databases to be searched.
118 may be a colon-separated list of databases.
119 A single colon is a reference
120 to the default database.
122 $ locate -d $HOME/lib/mydb: foo
125 will first search string
130 .Pa /var/db/locate.database .
132 $ locate -d $HOME/lib/mydb::/cdrom/locate.database foo
135 will first search string
140 .Pa /var/db/locate.database
142 .Pa /cdrom/locate.database .
144 .Dl "$ locate -d db1 -d db2 -d db3 pattern"
148 .Dl "$ locate -d db1:db2:db3 pattern"
152 .Dl "$ locate -d db1:db2 -d db3 pattern"
156 is given as the database name, standard input will be read instead.
157 For example, you can compress your database
160 $ zcat database.gz | locate -d - pattern
163 This might be useful on machines with a fast CPU and little RAM and slow
165 Note: you can only use
169 Ignore case distinctions in both the pattern and the database.
173 of file names and exit.
180 This is the default behavior
181 and is faster in most cases.
189 .Bl -tag -width LOCATE_PATH -compact
191 path to the locate database if set and not empty, ignored if the
193 option was specified.
196 .Bl -tag -width /etc/periodic/weekly/310.locate -compact
197 .It Pa /var/db/locate.database
199 .It Pa /usr/libexec/locate.updatedb
200 Script to update the locate database
201 .It Pa /etc/periodic/weekly/310.locate
202 Script that starts the database rebuild
209 .Xr locate.updatedb 8
213 .%T "Finding Files Fast"
221 command first appeared in
223 Many new features were
229 program may fail to list some files that are present, or may
230 list files that have been removed from the system.
232 locate only reports files that are present in the database, which is
233 typically only regenerated once a week by the
234 .Pa /etc/periodic/weekly/310.locate
238 to locate files that are of a more transitory nature.
242 database is typically built by user
245 .Xr locate.updatedb 8
246 utility skips directories
247 which are not readable for user
253 For example, if your HOME directory is not world-readable,
260 database is not byte order independent.
262 to share the databases between machines with different byte order.
265 implementation understands databases in host byte order or
266 network byte order if both architectures use the same integer size.
270 (little endian), you can read
271 a locate database which was built on SunOS/sparc machine
276 utility does not recognize multibyte characters.