locate command not working -solved

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

Published by kishan

You will know about me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: