1locate(1) General Commands Manual locate(1)
2
3
4
6 locate - find files by name
7
8
10 locate [OPTION]... PATTERN...
11
12
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 PATTERNs can contains globbing characters. If any PATTERN contains no
19 globbing characters, locate behaves as if the pattern were *PATTERN*.
20
21 By default, locate does not check whether files found in database still
22 exist. locate can never report files created after the most recent
23 update of the relevant database.
24
25
27 locate exits with status 0 if any match was found or if locate was
28 invoked with one of the --limit 0, --help, --statistics or --version
29 options. If no match was found or a fatal error was encountered,
30 locate exits with status 1.
31
32 Errors encountered while reading a database are not fatal, search con‐
33 tinues in other specified databases, if any.
34
35
37 -b, --basename
38 Match only the base name against the specified patterns.
39
40
41 -c, --count
42 Instead of writing file names on standard output, write the num‐
43 ber of matching entries only.
44
45
46 -d, --database DBPATH
47 Replace the default database with DBPATH. DBPATH is a :-sepa‐
48 rated list of database file names. If more than one --database
49 option is specified, the resulting path is a concatenation of
50 the separate paths.
51
52 An empty database file name is replaced by the default database.
53 A database file name - refers to the standard input. Note that
54 a database can be read from the standard input only once.
55
56
57 -e, --existing
58 Print only entries that refer to files existing at the time
59 locate is run.
60
61
62 -L, --follow
63 When checking whether files exist (if the --existing option is
64 specified), follow trailing symbolic links. This causes broken
65 symbolic links to be omitted from the output.
66
67 This is the default behavior.
68
69
70 -h, --help
71 Write a summary of the available options to standard output and
72 exit sucessfully.
73
74
75 -i, --ignore-case
76 Ignore case distinctions when matching patterns.
77
78
79 -l, --limit, -n LIMIT
80 Exit successfully after finding LIMIT entries. If the --count
81 option is specified, the resulting count is also limited to
82 LIMIT.
83
84
85 -m, --mmap
86 Ignored, for compatibility with BSD and GNU locate.
87
88
89 -P, --nofollow, -H
90 When checking whether files exist (if the --existing option is
91 specified), do not follow trailing symbolic links. This causes
92 broken symbolic links to be reported like other files.
93
94
95 -0, --null
96 Separate the entries on output using the ASCII NUL character
97 instead of writing each entry on a separate line. This option
98 is designed for interoprerability with the --null option of GNU
99 xargs(1).
100
101
102 -S, --statistics
103 Write statistics about each read database to standard output
104 instead of searching for files and exit successfully.
105
106
107 -q, --quiet
108 Write no messages about errors encountered while reading and
109 processing databases.
110
111
112 -r, --regexp REGEXP
113 Search for a basic regexp REGEXP. No PATTERNs are allowed if
114 this option is used, but this option can be specified multiple
115 times.
116
117
118 --regex
119 Interpret all PATTERNs as extended regexps.
120
121
122 -s, --stdio
123 Ignored, for compatibility with BSD and GNU locate.
124
125
126 -V, --version
127 Write information about the version and licence of locate on
128 standard output and exit sucessfully.
129
130
131 -w, --wholename
132 Match only the whole path name against the specified patterns.
133
134 This is the default behavior.
135
136
138 /var/lib/mlocate/mlocate.db
139 The database searched by default.
140
141
143 LOCATE_PATH
144 Path to additional databases, added after the default database
145 or the databases specified using the --database option.
146
147
149 The order in which the requested databases are processed is unspeci‐
150 fied, which allows locate to reorder the database path for security
151 reasons.
152
153 locate attempts to be compatible to slocate (without the options used
154 for creating databases) and GNU locate, in that order. This is the
155 reason for the impractical default --follow option and for the confus‐
156 ing set of --regex and --regexp options.
157
158 The short spelling of the -r option is incompatible to GNU locate,
159 where it corresponds to the --regex option. Use the long option names
160 to avoid confusion.
161
162 The LOCATE_PATH environment variable replaces the default database in
163 BSD and GNU locate, but it is added to other databases in this imple‐
164 mentation and slocate.
165
166
168 Miloslav Trmac <mitr@redhat.com>
169
170
172 updatedb(8)
173
174
175
176mlocate Jul 2005 locate(1)