output files in databases that match a pattern
-d path |
-l N |
[-w | --wholename] | [-b | --basename]
-P | |
Searches databases of file names created by
and outputs names that contain
The databases entries includes all parent directories and
. are not treated specially in
pattern is a plain string (i.e. it contains no metacharacters),
all names that contain that string are output as if
pattern began and ended with
hive is equivelent to
foo*bar will match names containing
fooMybar as well as
*duck* can match a name that contains
Patterns can contain shell-style metacharacters:
(which may need to be quoted to protect them from shell expansion).
patterns including metacharacters may need to begin with
* (to match parent directories).
Output going to a terminal will have control characters escaped in the same way as the
-print action of
Output statistics about the database and exit (unless |
--count is present)
Database /var/cache/locate/locatedb is in the GNU LOCATE02 format.
Locate database size: 929379 bytes
All Filenames: 81656
File names have a cumulative length of 3741662 bytes.
Of those file names,
132 contain whitespace,
0 contain newline characters,
and 11 contain characters with the high bit set.
Compression ratio 75.16% (higher is better)
Compression: Front: 12.16%, Bigram: 58.37%, Total: 8.59%
Filenames: 1118792, Characters: 132012888, Database size: 11336742
Bigram characters: 4719461, Integers: 71763, 8-Bit characters: 2344
Compare whole name (including parent directories). default.
only the final component of the name
| Limit the number of matches .
| Output a count of matches(not to exceed |
Output results with |
|Output only names which match all non-option arguments,
not those matching one or more non-option arguments.
Only output names that currently exist (instead those that existed when the database was created). |
This will take significantly longer ( It is possible for a file to be deleted after being checked, but before you access it)
Output names that currently do not exist (i.e. deleted since the database was built)
| Symbolic links are considered non-existing. Default.
| Symbolic links that are BROKEN are treated as existing files.
ASCII NUL as a separator, instead of newline.
pattern is a
regular expression as in
. matchs a newline.
Names whose full paths match the specified regular expression are considered matching.
To anchor regular expression at the ends of the full path name, use
databases are located in
path, a colon-separated list of
database file names overriding
Empty elements in the path indicate the default database.
A database can be supplied on
- as an element of path. If more than one element of path is
later instances are ignored and a warning message is printed.
$LOCATE_PATH Colon-separated list of databases to search.
With a leading or trailing colon, or has two colons in a row, results vary between different versions of locate.
find, locatedb(5), updatedb, xargs, glob.
The locate database handles filenames containing newlines if the system's
If you suspect that locate may need to return filenames containing newlines, consider using
Use Savannah.gnu.org to submit bugs.
updatedb - update a file name database for locate||GNU version|
The file name databases contain lists of files that were in the directory when the databases were
The name of the databases is determined when
updatedb are configured . The frequency with
which the databases are updated and the directories for which they contain
entries depend on how often
updatedb is run, and with which arguments.
In networked environments, it often makes sense to build a database at the
root of each filesystem, containing the entries for that filesystem.
updatedb is run for each filesystem on the fileserver where that
filesystem is on a local disk, to prevent thrashing the network. Users
can select which databases locate searches using an environment variable
or command line option; see
locate. Databases can not be concatenated
| Global options to pass to |
$FIND-OPTIONS). Default is
--localpaths=/path1 path2 …
| Local directories to include. Default is |
| The |
to search local directories as, using su.
Default is the current user.
--netpaths=path1 path2 ….
| Network (|
RFS, etc.) directories to include (
$NETPATHS . Default is
The user to search network directories as, using su
If the user does not have sufficient access a partial database will be updated.
--prunepaths=path1 path2 …
| Directories to exclude, no trailing slashes (|
|File systems to exclude.|
$PRUNEFS ) . Default is nfs NFS proc.
|Name of database , default is |
|Create the database in the old format
|display the version of |
updatedb and exit.
| display a summary of the options to updatedb and exit.
|security level. |
0 disable, faster. detault
| exclude directories
|starting path at |
| starting path at |
| output database. default |
| default |
# Filesystems that are pruned from updatedb database
PRUNEFS="auto mqueue proc supermount devpts afs autofs cifs devfs
eventpollfs futexfs gfs
hugetlbfs iso9660 ncpfs nfs NFS nfs4 nfsd nnpfs
pipefs ramfs rpc_pipefs selinuxfs sfs shfs smbfs
sockfs spufs subfs sysfs tmpfs udf usbfs vperfctrfs"
# Paths which are pruned from updatedb database
PRUNEPATHS="/tmp /var/tmp /root/.ccache"
# nice value to run at: see -n in nice
# ionice class to run at: see -c in ionice
# ionice priority to run at: see -n in ionice
|quiet no error messages
Correctly handles filenames containing newlines (who makes files with newlines anyway? ed),
only if sort has a working
-z option. If you suspect
that locate may need to return filenames containing newlines, consider
find, locatedb, xargs