Results 1 to 3 of 3
I am checking for a file if it is still exists, once I have deleted it using rm.
Below is the scenario...
locate test.txt
/root/test.txt
/var/www/html/test.txt
I have deleted those ...
- 05-25-2009 #1Just Joined!
- Join Date
- May 2009
- Posts
- 2
command locate unnecessary result
I am checking for a file if it is still exists, once I have deleted it using rm.
Below is the scenario...
locate test.txt
/root/test.txt
/var/www/html/test.txt
I have deleted those files using rm. And I ls the directory where was the files located, and with the ls results it shows that the test.txt file is not existing. But when I..
locate test.txt
It still return the result above.
/root/test.txt
/var/www/html/test.txt
Can someone tell me what's going wrong with the locate command...?
- 05-25-2009 #2Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,695
Try Google and the man page.
locate and slocate actually search a built-in database, named locate.db or slocate.db, respectively, rather than the entire hard disk drive itself, in order to provide a much shorter searching time. This database is automatically updated on a regular basis by cron, a small program that runs in the background, performing various tasks at regularly scheduled intervals. The updating is performed each night if the computer is on continuously.
Because the database is not updated immediately, recently created files and directories might not show up when searching for them with locate or slocate. Fortunately, however, it is a simple matter to update the database manually, although it might take a few minutes. Manual updating can be accomplished by logging in as the root user (i.e., administrative user), such as by using the su (i.e., substitute user) command, and then issuing the following command:
updatedb
- 05-25-2009 #3Just Joined!
- Join Date
- May 2009
- Posts
- 2
Thanks a lot!!! It help.


Reply With Quote