Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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
$() is much preferred over backticks, see – Dennis Williamson Jul 28 '09 at 2:34
up vote 11 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


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.