We may use find command to find a file in linux but it is a bit slower than Locate,
locate is a command that help us to find a file efficiently and a bit faster,
it maintains a database called
"/var/lib/mlocate/mlocate.db"
and also has a utility called "updatedb" which keeps this database updated with the
file which
are there in the system. so when we run this command this command runs it update
the database
and updates this database with newly file added. This database is kept by linux system to
keep most updated file list.
but suppose at some point of time if you think that you are not getting required result
inspite of the fact that file is present in the system, then you need to update this database.
so what you can do is that you can write a cron to update it frequently.
5 * * * * updatedb
this will update the database every five minute, keep it as your requirement.
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......