Back
Searches with the locate command are almost instantaneous. And locate searches don't require the full file-names. The drawback is that the locate command database is normally updated only once each day, as documented in the /etc/cron.daily/mlocate.cron script of Red Hat Enterprise Linux versions.
The locate command is often the simplest and quickest way to find the locations of files and directories on Linux and other Unix-like operating systems.
As daily jobs are run only once every 24 hours that's not good enough .Fortunately, the noted script can be executed directly from the command line interface, by the root administrator user, Just type in the full path to the file as if it were a command.
# /etc/cron.daily/mlocate.cron
Syntax :
locate [options] name(s)
When used without any options, locate displays every absolute path-name for which the user has access permission that contains any of the names of files and/or directories that are provided to it as arguments (i.e., input data).
The absolute path-name, also referred to as the absolute path or the full path, is the hierarchy of directories from the root directory to the designated file or directory.
The root directory is the directory at the very top of the file-system (i.e., hierarchy of files) that contains all other directories and files on the system and which is designated by a forward slash ( / ).
It is important that the absolute path-name is returned both because it tells the exact locations on the system and because it makes it possible to indicate the locations of files or directories that have the same name but different absolute paths.
For example :
The following would list the absolute paths of all files named file1 and all directories named dir1 for which the user had access permission:
#locate file1 dir1
It would also list any other absolute path-names that contained these strings (i.e., sequences of characters),
For example:
/home/john/file123 or /usr/local/mydir1/index.html.
Searches with the locate command are almost instantaneous. And locate searches don't require the full file-names. The drawback is that the locate command database is normally updated only once each day, as documented in the /etc/cron.daily/mlocate.cron script of Red Hat Enterprise Linux versions.
The locate command is often the simplest and quickest way to find the locations of files and directories on Linux and other Unix-like operating systems.
As daily jobs are run only once every 24 hours that's not good enough .Fortunately, the noted script can be executed directly from the command line interface, by the root administrator user, Just type in the full path to the file as if it were a command.
# /etc/cron.daily/mlocate.cron
Syntax :
locate [options] name(s)
When used without any options, locate displays every absolute path-name for which the user has access permission that contains any of the names of files and/or directories that are provided to it as arguments (i.e., input data).
The absolute path-name, also referred to as the absolute path or the full path, is the hierarchy of directories from the root directory to the designated file or directory.
The root directory is the directory at the very top of the file-system (i.e., hierarchy of files) that contains all other directories and files on the system and which is designated by a forward slash ( / ).
It is important that the absolute path-name is returned both because it tells the exact locations on the system and because it makes it possible to indicate the locations of files or directories that have the same name but different absolute paths.
For example :
The following would list the absolute paths of all files named file1 and all directories named dir1 for which the user had access permission:
#locate file1 dir1
It would also list any other absolute path-names that contained these strings (i.e., sequences of characters),
For example:
/home/john/file123 or /usr/local/mydir1/index.html.