man-pages/man1/mlocate.1.html
2021-03-31 01:06:50 +01:00

332 lines
8.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of locate</TITLE>
</HEAD><BODY>
<H1>locate</H1>
Section: User Commands (1)<BR>Updated: Sep 2012<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
locate - find files by name
<P>
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>locate</B> [<I>OPTION</I>]... <I>PATTERN</I>...
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>locate</B>
reads one or more databases prepared by
<B><A HREF="/cgi-bin/man/man2html?8+updatedb">updatedb</A></B>(8)
and writes file names matching at least one of the <I>PATTERN</I>s to standard
output, one per line.
<P>
If
<B>--regex</B>
is not specified,
<I>PATTERN</I>s can contain globbing characters.
If any
<I>PATTERN</I>
contains no globbing characters,
<B>locate</B>
behaves as if the pattern were <B>*</B><I>PATTERN</I><B>*</B>.
<P>
By default,
<B>locate</B>
does not check whether files found in database still exist
(but it does require all parent directories to exist
if the database was built with <B>--require-visibility no</B>).
<B>locate</B>
can never report files created after the most recent update of the relevant
database.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>EXIT STATUS</H2>
<B>locate</B>
exits with status 0 if any match was found or if
<B>locate</B>
was invoked with one of the <B>--limit 0</B>, <B>--help</B>,
<B>--statistics</B>
or
<B>--version</B>
options.
If no match was found or a fatal error was encountered,
<B>locate</B>
exits with status 1.
<P>
Errors encountered while reading a database are not fatal,
search continues in other specified databases, if any.
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>-A</B>, <B>--all</B><DD>
Print only entries that match all <I>PATTERN</I>s
instead of requiring only one of them to match.
<P>
<DT id="2"><B>-b</B>, <B>--basename</B><DD>
Match only the base name against the specified patterns.
This is the opposite of <B>--wholename</B>.
<P>
<DT id="3"><B>-c</B>, <B>--count</B><DD>
Instead of writing file names on standard output,
write the number of matching entries only.
<P>
<DT id="4"><B>-d, --database</B> <I>DBPATH</I><DD>
Replace the default database with <I>DBPATH</I>.
<I>DBPATH</I>
is a <B>:</B>-separated list of database file names.
If more than one
<B>--database</B>
option is specified,
the resulting path is a concatenation of the separate paths.
<P>
An empty database file name is replaced by the default database.
A database file name
<B>-</B>
refers to the standard input.
Note that a database can be read from the standard input only once.
<P>
<DT id="5"><B>-e</B>, <B>--existing</B><DD>
Print only entries that refer to files existing at the time
<B>locate</B>
is run.
<P>
<DT id="6"><B>-L</B>, <B>--follow</B><DD>
When checking whether files exist (if the
<B>--existing</B>
option is specified),
follow trailing symbolic links.
This causes broken symbolic links to be omitted from the output.
<P>
This is the default behavior.
The opposite can be specified using <B>--nofollow</B>.
<P>
<DT id="7"><B>-h</B>, <B>--help</B><DD>
Write a summary of the available options to standard output
and exit successfully.
<P>
<DT id="8"><B>-i</B>, <B>--ignore-case</B><DD>
Ignore case distinctions when matching patterns.
<P>
<DT id="9"><B>-p</B>, <B>--ignore-spaces</B><DD>
Ignore punctuation and spaces when matching patterns.
<P>
<DT id="10"><B>-t</B>, <B>--transliterate</B><DD>
Ignore accents using iconv transliteration when matching patterns.
<P>
<DT id="11"><B>-l</B>, <B>--limit</B>, <B>-n</B> <I>LIMIT</I><DD>
Exit successfully after finding
<I>LIMIT</I>
entries.
If the
<B>--count</B>
option is specified,
the resulting count is also limited to <I>LIMIT</I>.
<P>
<DT id="12"><B>-m</B>, <B>--mmap</B><DD>
Ignored, for compatibility with
<FONT SIZE="-1">BSD</FONT>
and
<FONT SIZE="-1">GNU</FONT>
<B>locate</B>.
<P>
<DT id="13"><B>-P</B>, <B>--nofollow</B>, <B>-H</B><DD>
When checking whether files exist (if the
<B>--existing</B>
option is specified),
do not follow trailing symbolic links.
This causes broken symbolic links to be reported like other files.
<P>
This is the opposite of <B>--follow</B>.
<P>
<DT id="14"><B>-0</B>, <B>--null</B><DD>
Separate the entries on output using the
<FONT SIZE="-1">ASCII NUL</FONT>
character instead of
writing each entry on a separate line.
This option is designed for interoperability with the
<B>--null</B>
option of
<FONT SIZE="-1">GNU</FONT>
<B><A HREF="/cgi-bin/man/man2html?1+xargs">xargs</A></B>(1).
<P>
<DT id="15"><B>-S</B>, <B>--statistics</B><DD>
Write statistics about each read database to standard output instead of
searching for files
and exit successfully.
<P>
<DT id="16"><B>-q</B>, <B>--quiet</B><DD>
Write no messages about errors encountered while reading and processing
databases.
<P>
<DT id="17"><B>-r</B>, <B>--regexp</B> <I>REGEXP</I><DD>
Search for a basic regexp <I>REGEXP</I>.
No <I>PATTERN</I>s are allowed if this option is used,
but this option can be specified multiple times.
<P>
<DT id="18"><B>--regex</B><DD>
Interpret all <I>PATTERN</I>s as extended regexps.
<P>
<DT id="19"><B>-s</B>, <B>--stdio</B><DD>
Ignored, for compatibility with
<FONT SIZE="-1">BSD</FONT>
and
<FONT SIZE="-1">GNU</FONT>
<B>locate</B>.
<P>
<DT id="20"><B>-V</B>, <B>--version</B><DD>
Write information about the version and license of
<B>locate</B>
on standard output and exit successfully.
<P>
<DT id="21"><B>-w</B>, <B>--wholename</B><DD>
Match only the whole path name against the specified patterns.
<P>
This is the default behavior.
The opposite can be specified using <B>--basename</B>.
<P>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>EXAMPLES</H2>
To search for a file named exactly
<I>NAME</I>
(not <B>*</B><I>NAME</I><B>*</B>), use
<DL COMPACT><DT id="22"><DD>
<B>locate -b</B>
<B>'\</B><I>NAME</I><B>'</B>
</DL>
Because <B>\</B> is a globbing character,
this disables the implicit replacement of
<I>NAME</I>
by <B>*</B><I>NAME</I><B>*</B>.
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="23"><B>/var/lib/mlocate/mlocate.db</B><DD>
The database searched by default.
<P>
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="24"><B>LOCATE_PATH</B><DD>
Path to additional databases,
added after the default database or the databases specified using the
<B>--database</B>
option.
<P>
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H2>NOTES</H2>
The order in which the requested databases are processed is unspecified,
which allows
<B>locate</B>
to reorder the database path for security reasons.
<P>
<B>locate</B>
attempts to be compatible to
<B>slocate</B>
(without the options used for creating databases) and
<FONT SIZE="-1">GNU</FONT>
<B>locate</B>, in that order.
This is the reason for the impractical default <B>--follow</B> option
and for the confusing set of <B>--regex</B> and <B>--regexp</B> options.
<P>
The short spelling of the <B>-r</B> option is incompatible to
<FONT SIZE="-1">GNU</FONT>
<B>locate</B>,
where it corresponds to the <B>--regex</B> option.
Use the long option names to avoid confusion.
<P>
The
<B>LOCATE_PATH</B>
environment variable replaces the default database in
<FONT SIZE="-1">BSD</FONT>
and
<FONT SIZE="-1">GNU</FONT>
<B>locate</B>,
but it is added to other databases in this implementation and <B>slocate</B>.
<P>
<A NAME="lbAK">&nbsp;</A>
<H2>AUTHOR</H2>
Miloslav Trmac &lt;<A HREF="mailto:mitr@redhat.com">mitr@redhat.com</A>&gt;
<P>
<A NAME="lbAL">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?8+updatedb">updatedb</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?1+iconv">iconv</A></B>(1),
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="25"><A HREF="#lbAB">NAME</A><DD>
<DT id="26"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="27"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="28"><A HREF="#lbAE">EXIT STATUS</A><DD>
<DT id="29"><A HREF="#lbAF">OPTIONS</A><DD>
<DT id="30"><A HREF="#lbAG">EXAMPLES</A><DD>
<DT id="31"><A HREF="#lbAH">FILES</A><DD>
<DT id="32"><A HREF="#lbAI">ENVIRONMENT</A><DD>
<DT id="33"><A HREF="#lbAJ">NOTES</A><DD>
<DT id="34"><A HREF="#lbAK">AUTHOR</A><DD>
<DT id="35"><A HREF="#lbAL">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:19 GMT, March 31, 2021
</BODY>
</HTML>