IPB
>  Man Pages > Unix > FreeBSD 6.2 > Section 1 > locate man page

locate man page

Section 1 - FreeBSD 6.2 Man Pages

Other operating system man pages available here


Advanced Search

Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!


LOCATE(1)               FreeBSD General Commands Manual              LOCATE(1)


NAME

     locate -- find filenames quickly


SYNOPSIS

     locate [-0Scims] [-l limit] [-d database] pattern ...


DESCRIPTION

     The locate program searches a database for all pathnames which match the
     specified pattern.  The database is recomputed periodically (usually
     weekly or daily), and contains the pathnames of all files which are pub-
     licly accessible.

     Shell globbing and quoting characters (``*'', ``?'', ``\'', ``['' and
     ``]'') may be used in pattern, although they will have to be escaped from
     the shell.  Preceding any character with a backslash (``\'') eliminates
     any special meaning which it may have.  The matching differs in that no
     characters must be matched explicitly, including slashes (``/'').

     As a special case, a pattern containing no globbing characters (``foo'')
     is matched as though it were ``*foo*''.

     Historically, locate only stored characters between 32 and 127.  The cur-
     rent implementation store any character except newline (`\n') and NUL
     (`\0').  The 8-bit character support does not waste extra space for plain
     ASCII file names.  Characters less than 32 or greater than 127 are stored
     in 2 bytes.

     The following options are available:

     -0          Print pathnames separated by an ASCII NUL character (charac-
                 ter code 0) instead of default NL (newline, character code
                 10).

     -S          Print some statistic about the database and exit.

     -c          Suppress normal output; instead print a count of matching
                 file names.

     -d database
                 Search in database instead the default file name database.
                 Multiple -d options are allowed.  Each additional -d option
                 adds the specified database to the list of databases to be
                 searched.

                 The option database may be a colon-separated list of data-
                 bases.  A single colon is a reference to the default data-
                 base.

                 $ locate -d $HOME/lib/mydb: foo

                 will first search string ``foo'' in $HOME/lib/mydb and then
                 in /var/db/locate.database.

                 $ locate -d $HOME/lib/mydb::/cdrom/locate.database foo

                 will first search string ``foo'' in $HOME/lib/mydb and then
                 in /var/db/locate.database and then in
                 /cdrom/locate.database.

                       $ locate -d db1 -d db2 -d db3 pattern

                 is the same as

                       $ locate -d db1:db2:db3 pattern

                 or

                       $ locate -d db1:db2 -d db3 pattern

                 If - is given as the database name, standard input will be
                 read instead.  For example, you can compress your database
                 and use:

                 $ zcat database.gz | locate -d - pattern

                 This might be useful on machines with a fast CPU and little
                 RAM and slow I/O.  Note: you can only use one pattern for
                 stdin.

     -i          Ignore case distinctions in both the pattern and the data-
                 base.

     -l number   Limit output to number of file names and exit.

     -m          Use mmap(2) instead of the stdio(3) library.  This is the
                 default behavior and is faster in most cases.

     -s          Use the stdio(3) library instead of mmap(2).


ENVIRONMENT

     LOCATE_PATH  path to the locate database if set and not empty, ignored if
                  the -d option was specified.


FILES

     /var/db/locate.database          locate database
     /usr/libexec/locate.updatedb     Script to update the locate database
     /etc/periodic/weekly/310.locate  Script that starts the database rebuild


SEE ALSO

     find(1), whereis(1), which(1), fnmatch(3), locate.updatedb(8)

     Woods, James A., "Finding Files Fast", ;login, 8:1, pp. 8-10, 1983.


HISTORY

     The locate command first appeared in 4.4BSD.  Many new features were
     added in FreeBSD 2.2.


BUGS

     The locate program may fail to list some files that are present, or may
     list files that have been removed from the system.  This is because
     locate only reports files that are present in the database, which is typ-
     ically only regenerated once a week by the
     /etc/periodic/weekly/310.locate script.  Use find(1) to locate files that
     are of a more transitory nature.

     The locate database was built by user ``nobody''.  The find(1) utility
     skips directories, which are not readable for user ``nobody'', group
     ``nobody'', or world.  E.g. if your HOME directory is not world-readable,
     all your files are not in the database.

     The locate database is not byte order independent.  It is not possible to
     share the databases between machines with different byte order.  The cur-
     rent locate implementation understand databases in host byte order or
     network byte order if both architectures use the same integer size.  So
     you can read on a FreeBSD/i386 machine (little endian) a locate database
     which was built on SunOS/sparc machine (big endian, net).

     The locate utility does not recognize multibyte characters.

FreeBSD 6.2                      July 23, 2004                     FreeBSD 6.2


Man(1) output converted with man2html and wrapped by fishsponge

This page was generated on Wed Sep 19 19:57:25 BST 2007

Your favourite pages:

No pages logged yet.
Trying to save cookie...

Top 10 most popular pages:

svn man page (5499 hits)
(FreeBSD 6.2)

sqlite3 man page (5423 hits)
(openSUSE 10.2)

adv_cap_autoneg man page (4921 hits)
(Solaris 10 11_06)

CPAN man page (4660 hits)
(Suse Linux 10.1)

ssh man page (4365 hits)
(Suse Linux 10.1)

ssh-socks5-proxy-connect man page (3081 hits)
(Solaris 10 11_06)

netcat man page (2906 hits)
(Suse Linux 10.1)

signal man page (2757 hits)
(Suse Linux 10.1)

pprosetup man page (2549 hits)
(Solaris 10 11_06)

startproc man page (2549 hits)
(Suse Linux 10.1)

Useful Links

Go Back

Visitor Statistics


Valid XHTML 1.0 Transitional     Valid CSS!

Partners: Cambridge Plus :: Pyrenees Mountain Holidays :: USB Temperature Monitor :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum