10

I have read that to run the locate command on CYGWIN, first I need to run the following command:

updatedb --localpaths=c:/ 

What does this command do exactly? As I run this on CYGWIN and it is taking too much time.

1
  • I'm assuming the OP has found a solution (or is no longer forced to use Windows), but I do wonder if a cron job is an option. I guess sometimes you're creating a lot of files and can't afford to wait until the following day. Commented Apr 22, 2024 at 19:45

2 Answers 2

8

This updates the locate database, which will indeed take a long time. It has to traverse every path on the system and then index it appropriately, which requires a lot of work (and a lot of resources).

While it's not really possible to speed up population of the database, you can make it less intrusive by increasing the niceness and io-niceness of updatedb. You can do this by using the nice and ionice utilities, in a manner similar to the following:

nice -n 19 ionice -c 3 updatedb --localpaths=c:/ 
1
  • @Elvin If you want to stop it, just send SIGTERM: pkill -x updatedb, assuming you have pkill, or find its PID and kill it (or if it is running in a terminal you have open, press C-c to send SIGINT). Commented Dec 24, 2013 at 4:33
1

While the statements in this answer are true, there may be other issues here.

In my case it took hours as the AV software was scanning every file that updatedb was accessing (i.e. almost every file on the disk) and it even caused OneDrive to download a few big files that were not on the disk (files that are in the cloud but not on the local disk get downloaded when they are accessed)

On the same hardware and indexing the same files, but without AV or OneDrive, it took minutes.

It may be a bug in Cygwin's updatedb as I don't think it should access to the content of files. Other similar software like locate32 doesn't cause this.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.