syntax :- locate <filename>
Find also similar to the locate command
syntax :- find </foldername> -name <filename?
ex :- find /tmp -name file1
I just created a file which doesnt showup with locate/find command ?
yes usually database will update by linux cronjob which typically runs during night. In order to update the database right away run # updatedb
[root@linuxtechnotes ~]#
[root@linuxtechnotes ~]# locate file20
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@linuxtechnotes ~]# touch /tmp/file20
[root@linuxtechnotes ~]# locate file20
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
[root@linuxtechnotes ~]# updatedb
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# find /tmp/ -name file20
/tmp/file20
[root@linuxtechnotes ~]# updatedb
[root@linuxtechnotes ~]# locate file20
[root@linuxtechnotes ~]# find /tmp/ -name file21
[root@linuxtechnotes ~]# touch /tmp/file21
[root@linuxtechnotes ~]# find /tmp/ -name file21
/tmp/file21
[root@linuxtechnotes ~]#
No comments:
Post a Comment