Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was just trying to find a file on my test webserver so I ran "locate foo.conf" and it told me it was in /usr/lib. But then when I went to /usr/lib, I couldn't find the file.

So I tried running "ls $(locate foo.conf)" and it told me that the file didn't exist. Does anybody know why this would happen?

share|improve this question
2  
Have you tried running a database update: "updatedb" and see if the file still exists? –  l0c0b0x Jul 27 '09 at 21:06
    
What was the purpose of switching from locate foo.conf to $(locate foo.conf) ? –  thepocketwade Jul 27 '09 at 21:57
1  
thepocketwise: The backticks were not showing up, as they don't in your comment, at least in my browser ... –  Kyle Brandt Jul 27 '09 at 22:55
    
ahh, I see now, thanks. –  thepocketwade Jul 27 '09 at 23:04
1  
$() is much preferred over backticks, see mywiki.wooledge.org/BashFAQ/082 –  Dennis Williamson Jul 28 '09 at 2:34

1 Answer 1

up vote 10 down vote accepted

locate uses a database generated and updated by the updatedb command that is run by cron ( usually every night). So it is possible your database is out of date. Try the following and then run the locate command again:

sudo updatedb
share|improve this answer
    
Sure enough, it doesn't find the file anymore. –  thepocketwade Jul 28 '09 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.