The updatedb
command creates or updates the database used by the locate
command. If the database already exists, updatedb
reuses its data to avoid rereading unchanged directories. Typically, updatedb
is run by cron
every day to update the default database.
updatedb [OPTION]...
-f, --add-prunefs FS
: Add entries in the space-separated listFS
toPRUNEFS
.-n, --add-prunenames NAMES
: Add entries in the space-separated listNAMES
toPRUNENAMES
.-e, --add-prunepaths PATHS
: Add entries in the space-separated listPATHS
toPRUNEPATHS
.-U, --database-root PATH
: Store only the results of scanning file system subtrees rooted at paths for which the path of the database to be generated, by default, will scan the whole file system, i.e./
, andlocate
outputs entries as absolute pathnames, regardless of the forms ofPATH
is specified.-h, --help
: Display help information.-o, --output FILE
: Write the database to the file instead of using the default database. Default database location is/var/lib/mlocate/mlocate.db
.--prune-bind-mounts FLAG
: SetPRUNE_BIND_MOUNTS
toFLAG
, overriding the configuration file, default isno
.--prunefs FS
: SetPRUNEFS
toFS
, overriding the configuration file.--prunenames NAMES
: SetPRUNENAMES
toNAMES
, overriding the configuration file.--prunepaths PATHS
: SetPRUNEPATHS
toPATHS
, overriding the configuration file.-l, --require-visibility FLAG
: Set flag in the generated database for "require files' visibility before reporting" toFLAG
, default value isyes
. IfFLAG
is0
orno
, or the database file is readable byothers
or not owned byslocate
, thenlocate
outputs database entries that user runninglocate
cannot read necessary directories to find files described by database entries. IfFLAG
is1
oryes
,locate
checks the permissions of each entry's parent directory before reporting the parent directory of each entry to the calling user. To truly hide the existence of a file, the database group is set toslocate
, and the database permissions prevent users from reading the user's database other thanlocate set-gid slocate
. Note that visibility check only occurs when the database is owned byslocate
and not readable byothers
.-v, --verbose
: Output the path names of files to standard output.-V, --version
: Output version information.
Update the database used by the locate
command.
updatedb
Update the database used by the locate
command and output the found files.
updatedb -v
Specify the directory for updating the database used by the locate
command.
updatedb -U /home
https://github.com/WindrunnerMax/EveryDay
https://linux.die.net/man/8/updatedb
https://www.computerhope.com/unix/ulocate.htm
https://www.runoob.com/linux/linux-comm-updatedb.html