Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm trying to use locate to find files, but I'm not getting anything back from the program. It can't even find files that are in the current directory. How do I make locate work?

share|improve this question

migrated from Nov 23 '09 at 12:36

This question came from our site for professional and enthusiast programmers.

use sudo updatedb ? – ukanth Nov 23 '09 at 12:50
up vote 11 down vote accepted

In essence, you have to run updatedb first, as this builds the database that locate uses.
Simply do updatedb --localpaths=c:/ as a first shot solution.

See this blog post for a bunch of good tips , including how to setup up updatedb via cygwin cron:

Google 'cygwin updatedb' for a relevant post if you are having trouble with paths that include spaces. I am not getting any trouble (other than permission denied) on WinXP Pro, but other platforms may require this.

share|improve this answer
The blogpost has a new address,… – Stefan Rasmusson Sep 16 '13 at 13:07

To use locate you need to run updatedb first.

share|improve this answer

I think the command you want is find

Do man find to see the syntax and options

The locate command runs against a pre-built database of filenames

share|improve this answer
Yes, locate runs against a pre-built database. Why does that mean the OP wants find instead? – CarlF Nov 23 '09 at 15:01
Find will at least do the job that is being requested if locate is not present or for what-ever reason not functioning. More slowly, as it won't have the pre-prepared data to search, but it will work and the results are more likely to be properly uptodate and complete (updatedb may have been configured to exclude some parts of the filesystem). – David Spillett Apr 22 '10 at 13:06

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.