locate command not working -solved

Cause:

locate is often used to search for the files on the linux server.

Sometimes we try to search some file and locate returns nothing.

we think the file is not present on the server though the file exist

[oracle@orcl ~]$ locate file
[oracle@orcl ~]$

Solution:

we have to use updatedb to update the locate repository file and it works like a charm!!

[oracle@orcl ~]$ updatedb
updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db'
[oracle@orcl ~]$ su
Password:
[root@orcl oracle]# updatedb
[oracle@orcl ~]$ locate messages-20200209.gz
/var/log/messages-20200209.gz

Leave a Reply