Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to index my entire disk for quick search. I tried Tracker, but it doesn't let me add "/" as a recursively indexed directory. How can I do this?

share|improve this question

migrated from stackoverflow.com Jan 11 '11 at 18:59

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

    
This question is not related to programming. So it would be more appropriate at askubuntu.com , or serverfault.com , or superuser.com . –  imz Jan 10 '11 at 6:41
add comment

2 Answers

updatedb / locate is certainly a good choice, if you're looking to index file names. See/upvote cYrus's answer.

However, another option is to simply use find to list the names of all files on your hard drive, and put them in a file:

sudo find / > files.list

Later on, you can look for files with grep:

grep 'myfavoritesong' files.list

Although this looks pretty lame, it actually tends to be fast in practice, even when you have a lot of files.

Of course, that hardly does anything better than locate. However, it is a quick and easy way to index external hard drives.

Taking it further, you may want to hash all the files on your hard drive:

sudo find / -type f -exec sha256sum {} \; > files.sha256

This will probably take a long time.

What it does for you is it gives you a way to locate identical files. Say you find a huge .iso file on your computer:

$ sha256sum huge.iso
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824  huge.iso

You have a feeling that the same file exists somewhere else on your hard drive, and you want to delete one of them to save space. You can grep through the list of hashes to find it:

$ grep 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 files.sha256
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824  huge.iso
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824  archive/path/to/other/huge.iso
share|improve this answer
    
+1: It's an interesting solution. A little bit tricky and maybe not so fast, but surely "didactical"; IMO useful. –  cYrus Jan 11 '11 at 22:04
add comment

It should already be indexed regularly with scheduled executions of updatedb that's used by locate. For more info refer to the man of these two programs.

Note: I'm talking about file names only.

share|improve this answer
add comment

Your Answer

 
discard

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.