1 .TH LOCATE 1 \" -*- nroff -*-
3 locate \- list files in databases that match a pattern
6 [\-d path | \-\-database=path] [\-e | \-E | \-\-[non\-]existing] [\-i
7 | \-\-ignore-case] [\-0 | \-\-null] [\-c | \-\-count] [\-w | \-\-wholename]
8 |\-b | \-\-basename] [\-l N | \-\-limit=N] [\-S | \-\-statistics] [\-r
9 | \-\-regex ] [\-\-max-database-age D] [\-P | \-H | \-\-nofollow] [\-L
10 | \-\-follow] [\-\-version] [\-A | \-\-all] [\-p | \-\-print] [\-\-help] pattern...
13 documents the GNU version of
15 For each given pattern,
17 searches one or more databases of file names and displays the
18 file names that contain the pattern. Patterns can contain shell-style
19 metacharacters: `*', `?', and `[]'. The metacharacters do not treat
20 `/' or `.' specially. Therefore, a pattern `foo*bar' can match a
21 file name that contains `foo3/bar', and a pattern `*duck*' can match a
22 file name that contains `lake/.ducky'. Patterns that contain
23 metacharacters should be quoted to protect them from expansion by the
26 If a pattern is a plain string \(em it contains no metacharacters \(em
28 displays all file names in the database that contain that string
29 anywhere. If a pattern does contain metacharacters,
31 only displays file names that match the pattern exactly. As a result,
32 patterns that contain metacharacters should usually begin with a `*',
33 and will most often end with one as well. The exceptions are patterns
34 that are intended to explicitly match the beginning or end of a file
37 The file name databases contain lists of files that were on the system
38 when the databases were last updated. The system administrator can
39 choose the file name of the default database, the frequency with which
40 the databases are updated, and the directories for which they contain
41 entries; see \fBupdatedb\fP(1).
45 output is going to a terminal, unusual characters in the output are
46 escaped in the same way as for the \-print action of the
48 command. If the output is not going to a terminal, file names are
49 printed exactly as-is.
54 Use ASCII NUL as a separator, instead of newline.
57 Print only names which match all non-option arguments, not those matching
58 one or more non-option arguments.
60 .I "\-b, \-\-basename"
61 Results are considered to match if the pattern specified matches the
62 final component of the name of a file as listed in the database.
63 This final component is usually referred to as the `base name'.
66 Instead of printing the matched filenames, just print the total
67 number of matches we found, unless \-\-\fIprint\fP (\-p) is also present.
69 .I "\-d \fIpath\fP, \-\-database=\fIpath\fP"
70 Instead of searching the default file name database, search the file
71 name databases in \fIpath\fP, which is a colon-separated list of
72 database file names. You can also use the environment variable
74 to set the list of database files to search.
75 The option overrides the environment variable if both are used. Empty
76 elements in the path are taken to be synonyms for the file name of the
78 A database can be supplied on stdin, using `\-' as an element
79 of \fIpath\fP. If more than one element of \fIpath\fP is `\-',
80 later instances are ignored (and a warning message is printed).
82 The file name database format changed starting with GNU
86 version 4.0 to allow machines with different byte orderings to share
87 the databases. This version of
89 can automatically recognize and read databases produced for older
96 Support for the old locate database format will be discontinued in a
99 .I "\-e, \-\-existing"
100 Only print out such names that currently exist (instead of such names
101 that existed when the database was created).
102 Note that this may slow down the program a lot, if there are many matches
103 in the database. If you are using this option within a program,
104 please note that it is possible for the file to be deleted after
106 has checked that it exists, but before you use it.
108 .I "\-E, \-\-non\-existing"
109 Only print out such names that currently do not exist (instead of such names
110 that existed when the database was created).
111 Note that this may slow down the program a lot, if there are many matches
115 Print a summary of the options to
119 .I "\-i, \-\-ignore-case"
120 Ignore case distinctions in both the pattern and the file names.
122 .I "\-l N, \-\-limit=N"
123 Limit the number of matches to N. If a limit is set via this option,
124 the number of results printed for the \-c option will never be larger
128 If testing for the existence of files (with the \-e or \-E options),
129 consider broken symbolic links to be non-existing. This is the default.
131 .I "\-\-max-database-age D"
134 will issue a warning message when it searches a database which is more
135 than 8 days old. This option changes that value to something other
136 than 8. The effect of specifying a negative value is undefined.
139 Accepted but does nothing, for compatibility with BSD
142 .I "\-P, \-H, \-\-nofollow"
143 If testing for the existence of files (with the \-e or \-E options), treat
144 broken symbolic links as if they were existing files. The \-H
145 form of this option is provided purely for similarity with
147 the use of \-P is recommended over \-H.
150 Print search results when they normally would not, because of the presence
151 of \-\-statistics (\-S) or \-\-count (\-c).
154 The pattern specified on the command line is understood to be a
155 regular expression, as opposed to a glob pattern. The Regular
156 expressions work in the same was as in
160 except for the fact that "." will match a newline.
161 Filenames whose full paths match the specified regular expression are
162 printed (or, in the case of the \-c option, counted). If you wish to
163 anchor your regular expression at the ends of the full path name, then
164 as is usual with regular expressions, you should use the characters ^
165 and $ to signify this.
168 Accepted but does nothing, for compatibility with BSD
171 .I "\-S, \-\-statistics"
172 Print various statistics about each locate database and then exit
173 without performing a search, unless non-option arguments are given.
174 For compatibility with BSD, \-S is accepted as a synonym
175 for \-\-statistics. However, the ouptut of
177 is different for the GNU and BSD implementations of
181 Print the version number of
185 .I "\-w, \-\-wholename"
186 Match against the whole name of the file as listed in the database.
191 Colon-separated list of databases to search. If the value has a
192 leading or trailing colon, or has two colons in a row, you may get
193 results that vary between different versions of
197 \fBfind\fP(1), \fBlocatedb\fP(5), \fBupdatedb\fP(1), \fBxargs\fP(1),
199 \fBFinding Files\fP (on-line in Info, or printed)
203 program started life as the BSD fast find program, contributed to BSD
204 by James A. Woods. This was described by his paper
205 .I Finding Files Fast
206 which was published in Usenix
208 Vol 8, No 1, February/March, 1983, pp. 8-10. When the
210 program began to assume a default
212 action if no action was specified, this changed the interpretation of
215 The BSD developers therefore moved the fast find functionality into
217 The GNU implementation of
219 appears to be derived from the same code.
221 Significant changes to
227 4.3.7 | Byte-order independent support for old database format
228 4.3.3 | locate \fI\-i\fR supports multi-byte characters correctly
229 | Introduced \fI\-\-max_db_age\fR
230 4.3.2 | Support for the slocate database format
231 4.2.22| Introduced the \fI\-\-all\fR option
232 4.2.15| Introduced the \fI\-\-regex\fR option
233 4.2.14| Introduced options \fI\-L, \-P, \-H\fR
234 4.2.12| Empty items in \fBLOCATE_PATH\fR now indicate the default database
235 4.2.11| Introduced the \fI\-\-statistics\fR option
236 4.2.4 | Introduced \fI\-\-count\fR and \fI\-\-limit\fR
237 4.2.0 | Glob characters cause matching against the whole file name
238 4.0 | Introduced the LOCATE02 database format
239 3.7 | Locate can search multiple databases
243 The locate database correctly handles filenames containing newlines,
244 but only if the system's sort command has a working
246 option. If you suspect that
248 may need to return filenames containing newlines, consider using its
252 The best way to report a bug is to use the form at
253 http://savannah.gnu.org/bugs/?group=findutils.
254 The reason for this is that you will then be able to track progress in
255 fixing the problem. Other comments about \fBlocate\fP(1) and about
256 the findutils package in general can be sent to the
258 mailing list. To join the list, send email to
259 .IR bug-findutils-request@gnu.org .