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 .\" 4. Neither the name of the University nor the names of its contributors
14 .\" may be used to endorse or promote products derived from this software
15 .\" without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" @(#)locate.1 8.1 (Berkeley) 6/6/93
30 .\" $FreeBSD: src/usr.bin/locate/locate/locate.1,v 1.16.2.5 2002/07/08 21:31:28 trhodes Exp $
31 .\" $DragonFly: src/usr.bin/locate/locate/locate.1,v 1.4 2006/02/17 19:39:09 swildner Exp $
38 .Nd find filenames quickly
48 program searches a database for all pathnames which match the specified
50 The database is recomputed periodically (usually weekly or daily),
51 and contains the pathnames
52 of all files which are publicly accessible.
54 Shell globbing and quoting characters
63 although they will have to be escaped from the shell.
64 Preceding any character with a backslash
66 eliminates any special
67 meaning which it may have.
68 The matching differs in that no characters must be matched explicitly,
72 As a special case, a pattern containing no globbing characters
74 is matched as though it were
77 Historically, locate only stored characters between 32 and 127. The
78 current implementation store any character except newline
82 The 8-bit character support doesn't waste extra space for
83 plain ASCII file names.
84 Characters less than 32 or greater than 127
85 are stored in 2 bytes.
87 The following options are available:
90 Print some statistic about the database and exit.
92 Suppress normal output; instead print a count of matching file names.
96 instead the default file name database.
99 options are allowed. Each additional
101 option adds the specified database to the list
102 of databases to be searched.
106 may be a colon-separated list of databases.
107 A single colon is a reference
108 to the default database.
110 $ locate -d $HOME/lib/mydb: foo
113 will first search string
118 .Pa /var/db/locate.database .
120 $ locate -d $HOME/lib/mydb::/cdrom/locate.database foo
123 will first search string
128 .Pa /var/db/locate.database
130 .Pa /cdrom/locate.database .
132 $ locate -d db1 -d db2 -d db3 pattern
137 $ locate -d db1:db2:db3 pattern
142 .Dq $ locate -d db1:db2 -d db3 pattern .
147 is given as the database name, standard input will be read instead.
148 For example, you can compress your database
151 $ zcat database.gz | locate -d - pattern
154 This might be useful on machines with a fast CPU and little RAM and slow
155 I/O. Note: you can only use
159 Ignore case distinctions in both the pattern and the database.
163 of file names and exit.
170 This is the default behavior
171 and is faster in most cases.
179 .Bl -tag -width LOCATE_PATH -compact
181 path to the locate database if set and not empty, ignored if the
183 option was specified.
186 .Bl -tag -width /etc/periodic/weekly/310.locate -compact
187 .It Pa /var/db/locate.database
189 .It Pa /usr/libexec/locate.updatedb
190 Script to update the locate database
191 .It Pa /etc/periodic/weekly/310.locate
192 Script that starts the database rebuild
199 .Xr locate.updatedb 8
203 .%T "Finding Files Fast"
211 command first appeared in
213 Many new features were
219 program may fail to list some files that are present, or may
220 list files that have been removed from the system. This is because
221 locate only reports files that are present in the database, which is
222 typically only regenerated once a week by the
223 .Pa /etc/periodic/weekly/310.locate
226 to locate files that are of a more transitory nature.
230 database was built by user
234 which are not readable for user
240 E.g. if your HOME directory is not world-readable, all your
247 database is not byte order independent.
249 to share the databases between machines with different byte order.
252 implementation understand databases in host byte order or
253 network byte order if both architectures use the same integer size.
258 a locate database which was built on SunOS/sparc machine