Locate, Find, Which - How do I launch an index/scan command for these utilities?

How do I re-scan my drive so my 'search utilities' are able to find a new file on my system?

I'm having a tough time googling HOW TOs for launching an index/scan command to any of this applications. I mostly use: 'find' and 'locate', but thought it would be a good idea to know about other search apps and their index/scan commands (Sorry, don't know what to best call it: index or scan for scanning new files on the system).

  • My problem: I install or download a new file to the system but don't know where.
  • My Need: To scan my drive (preferably by folder, but i'm willing to live with a full scan)
  • My OS: Linux Debian (Lenny)

Thank you!


Solution 1:

Find does not need an index, and traverses the disk every time you run it. Example

$ find / -name "*mynewprogram*"

locate and variants need index files, but they work -really- faster. 'locate' is from GNU findutils. 'slocate' was recommended up to etch; it was a more 'secure' version of locate, users will not see files that they do not have acess to. 'mlocate' is recommended in lenny and newer, mlocate has a more efficient indexing mechanism.

$ sudo updatedb  # to update the index.
$ mlocate  mynewprogram

which searches your $PATH for the binary name you give. No need for an index.

$ which touch
/usr/bin/touch

If you want to see a package's installed files, use this

dpkg -L coreutils

To see which package installed a specific file

$ dpkg -S /usr/bin/touch
coreutils: /usr/bin/touch

Solution 2:

try

updatedb -v

[ -v to be sure it actually works ;-]

i also use sometimes

cd /whatever/is/the/path
find .|grep -i somePatternMatchingWhatIneed