0

i run a Ubuntu box on my PC, and the Ubuntu is install as dual-system, i mean the PC have a Ubuntu and a WIN7.

So i use the locate command to find a file, it often list a lot files existing in windows system , for example, it usually list some content under /host/.. , those is under WINDOWS. thus not only time consuming, but also make me not easy find what i want.

My question is :How to set the parameter of locate command and avoid such a problem? make the locate cmd just find files under linux directory?

2 Answers 2

3

edit /etc/updatedb.conf

sudo nano /etc/updatedb.conf

find the line

PRUNEPATHS="/tmp /var/spool /media"

add in host

PRUNEPATHS="/tmp /var/spool /media /host"

save your changes, then run

sudo updatedb
2
sudo updatedb --prunepaths='/host'

This might take a little while to run.

According to man locate, and man updatedb, locate uses a database to find files. This database is modified using updatedb. The --prunepaths argument stops locate from looking along the paths listed. (you can list multiple paths within the single quotes, separated by spaces, and leaving off the trailing slashes)

If you want to search on /host later, run sudo updatedb with no arguments.

1
  • that is a temporary solution, updatebe will overwrite the result next time it runs.
    – Panther
    Jan 4, 2014 at 4:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .