1locate(1) General Commands Manual locate(1)
2
3
4
6 plocate - find files by name, quickly
7
8
10 plocate [OPTION]... PATTERN...
11
12
14 plocate finds all files on the system matching the given pattern (or
15 all of the patterns if multiple are given). It does this by means of an
16 index made by updatedb(8) or (less commonly) converted from another in‐
17 dex by plocate-build(8).
18
19 plocate is largely argument-compatible with mlocate(1), but is signifi‐
20 cantly faster. In particular, it rarely needs to scan through its en‐
21 tire database, unless the pattern is very short (less than three bytes)
22 or you want to search for a regular expression. It does not try to
23 maintain compatibility with BSD locate, or non-UTF-8 filenames and lo‐
24 cales. Most I/O is done asynchronously, but the results are synchro‐
25 nized so that output comes in the same order every time.
26
27 When multiple patterns are given, plocate will search for files that
28 match all of them. This is the main incompatibility with mlocate(1),
29 which searches for files that match one or more patterns, unless the -A
30 option is given.
31
32 By default, patterns are taken to be substrings to search for. If at
33 least one non-escaped globbing metacharacter (*, ? or []) is given,
34 that pattern is instead taken to be a glob pattern (which means it
35 needs to start and end in * for a substring match). If --regexp is
36 given, patterns are instead taken to be (non-anchored) POSIX basic reg‐
37 ular expressions, and if --regex is given, patterns are taken to be
38 POSIX extended regular expressions. All of this matches mlocate(1) be‐
39 havior.
40
41 Like mlocate(1), plocate shows all files visible to the calling user
42 (by virtue of having read and execute permissions on all parent direc‐
43 tories), and none that are not, by means of running with the setgid bit
44 set to access the index (which is built as root), but by testing visi‐
45 bility as the calling user.
46
47
49 plocate exits with 0 to indicate that a match was found or that --help
50 or --version were passed. Otherwise, plocate exits with status code 1,
51 indicating that an error occurred or that no matches were found.
52
53
55 -A, --all
56 Ignored for compatibility with mlocate(1).
57
58
59 -b, --basename
60 Match only against the file name portion of the path name, ie.,
61 the directory names will be excluded from the match (but still
62 printed). This does not speed up the search, but can suppress
63 uninteresting matches.
64
65
66 -c, --count
67 Do not print each match. Instead, count them, and print out a
68 total number at the end.
69
70
71 -d, --database DBPATH
72 Find matches in the given database, instead of /var/lib/plo‐
73 cate/plocate.db. This argument can be given multiple times, to
74 search multiple databases. It is also possible to give multiple
75 databases in one argument, separated by :. (Any character, in‐
76 cluding : and \, can be escaped by prepending a \.)
77
78
79 -e, --existing
80 Print only entries that refer to files existing at the time lo‐
81 cate is run. Note that unlike mlocate(1), symlinks are not fol‐
82 lowed by default (and indeed, there is no option to change
83 this).
84
85
86 -i, --ignore-case
87 Do a case-insensitive match as given by the current locale (de‐
88 fault is case-sensitive, byte-by-byte match). Note that plocate
89 does not support the full range of Unicode case folding rules;
90 in particular, searching for ß will not give you matches on ss
91 even in a German locale. Also note that this option will be
92 somewhat slower than a case-sensitive match, since it needs to
93 generate more candidates for searching the index.
94
95
96 -l, --limit LIMIT
97 Stop searching after LIMIT matches have been found. If --count
98 is given, the number printed out will be at most LIMIT.
99
100
101 -N, --literal
102 Print entry names without quoting. Normally, plocate will escape
103 special characters in filenames, so that they are safe for con‐
104 sumption by typical shells (similar to the GNU coreutils shell-
105 escape-always quoting style), unless printing to a pipe, but
106 this options will turn off such quoting.
107
108
109 -0, --null
110 Instead of writing a newline after every match, write a NUL
111 (ASCII 0). This is useful for creating unambiguous output when
112 it is to be processed by other tools (like xargs(1)), as file‐
113 names are allowed to contain embedded newlines.
114
115
116 -r, --regexp
117 Patterns are taken to be POSIX basic regular expressions. See
118 regex(7) for more information. Note that this forces a linear
119 scan through the entire database, which is slow.
120
121
122 --regex
123 Like --regexp, but patterns are instead taken to be POSIX ex‐
124 tended regular expressions.
125
126
127 -w, --wholename
128 Match against the entire path name. This is the default, so un‐
129 less -b is given first (see above), it will not do anything.
130 This option thus exists only as compatibility with mlocate(1).
131
132
133 --help Print out usage information, then exit successfully.
134
135
136 --version
137 Print out version information, then exit successfully.
138
139
141 LOCATE_PATH
142 If given, appended after the list of --database paths (whether
143 an explicit is given or the default is used). Colon-delimiting
144 and character escaping follows the same rules as for --database.
145
146
148 Steinar H. Gunderson <steinar+plocate@gunderson.no>
149
150
152 plocate-build(8), mlocate(1), updatedb(8)
153
154
155
156plocate Oct 2020 locate(1)