My favourite little KDE gem of the week is kio_locate. Its maintainer, Armin has now added support for regular expressions and piping results through grep. This increases usefulness by at least a factor of 10...
Ahhh -- you didn't know kio_locate at all up to now? Don't fear: until last Saturday not even distinguished KDE core hackers such as danimo did. After I showed it to him, he was sold. (In return, he promised to burn a CD with legal sound files for me to test the new amaroK with... danimo, I'm waiting.).
kio_locate is one very small, but oh!, so useful little addition to KDE. It utilizes the powerful, yet still underrated KIO Slave architecture of KDE. KIO slaves add "protocols" to your desktop and let each application use these. A good first introduction you can gain from a recent article published on O'Reilly's OSDir.com website.
So what about kio_locate? We all know the good old locate command. Some of us, who haven't organized their directory hierarchy too well, type "locate sylvia.jpg" (or whatever we happen to search for) every day into a konsole window. The result we got, we then highlighted and pasted into the address field of gwenview (or whatever cool image viewer program we happen to prefer). Quite an effort.
With kio_locate you can do (nearly) the same now in a Konqueror address field. Type in "locate:sylvi.jpg" and you'll get a list of matching pathnames in a konqueror window. Now you can do whatever you wanted to: click on one of the results to open it in your imaging application, drag it to a new location, copy it to another place, cram all matching pics into a *.tar.gz-archive... No detour needed via konsole -- do all at one place.
As with all KIO Slaves, kio_locate isn't just for the Konqui address field. It can be used in each and every KDE application that understands URLs. Most important of all, you can use it directly in all "File Open" dialogs. Again, this safes lots of detours, clicks and typing effort.
kio_locate isn't part of KDE currently. Hopefully it will be in 3.4. But to download it, untar/-zip and type ./configure; make; sudo make install didnt take more than 5 minutes. Achim even provides the required documentation. After doing ALT+F2, typing khelpcenter, I easily found the little manual in the "kioslaves" section of the documentation. It is also online. And if you are keen for screenshots, look here.
- Can you make the search case-insensitive?
Yes, you can. Use "ilocate:sYlVi.JPG" . - Can you get the matching result of, say locate kdeprint | grep -v kde-unstable | grep lib ?
Yes, you can. Use "locate:kdeprint !kde-unstable lib" .
This last item took only a little question on KDE-kapps.org to ask. And 3 days later Achim had implemented it. Cheers, Achim!

yay!
Kio_Locate is a great kio slave! Fortunately (unfortunately?) I'm rather organized with my files so I don't get to use it all that often. Someone said about the problems of having to have an updated search db, but in probably most cases it will be for a file that isn't accessed very often (or a system file that shouldn't be moving), that way even if the DB hasn't been updated in a week it will still find it.
Oh and on my computer updatedb is ran on the lowest niceness level so having it run when the computer is idle (as someone else mentioned) isn't needed because of Linux's (and other UNIX's) excellent multitasking capabilities.
Its good to see that it will probably be in 3.4 (since now lots of people are gonna learn about it from this blog).
What is the use of locate
Personally I've never seen the point of locate. It only really has a chance of working on machines which are running constantly (e.g. servers and the workstations of KDE geeks). Then you have to have cron running in order to update the database. Which is very very very disk intensive. Just in case you decided to search the whole hard disk, rather than say, oooh, your home directory.
Then if you make changes to the file location you have to update the database again. So you might get a search result back and it might be wrong because the file system has already changed. So you have to use 'find' anyway.
Progress? Hmmm.
For those who use locate, kio_locate is awesome!
OK, Chris, if you don't use "locate" in the first place, "kio_Locate" will be of no use whatsoever to you. (It wouldn't even work).
Some of your objections are valid -- such as that it isnt always up-to-date, or that it is best if the computer using it is not shut down every evening.
My own PC runs for months and months and cronjobs "updatedb" every night. Also, the files I am looking for, are most of the time a few days or several months old -- and locate always finds them just fine, within a second.
"locate" for me always was incredibly useful, despite its limitations. And so is "kio_locate" now.
Maybe the Google Desktop Sear
Maybe the Google Desktop Search approach would be doable?
GDS processes and collects data on all new/changed files, only when the computer is idle.
Though locate only looks for filenames, GDS also searches through text files, mail, IM chat logs etc. Implementing such features in KDE would require quite a bit of work though and locate wouldn't be enough anymore. Maybe one could use grep for the task?
More in-depth search for KDE is on its way...
Maybe you want to look at the "kdenonbeta/klink" initial files in CVS. Aaron J. Seigo and Scott Wheeler have started to work on this during aKademy. See also Scotts aKademy talk "Beyond Hierarchical Data: Search and Meta Data as Fundamental Interface Elements":
Some info material is here for you to investigate:
hmmm
think this has to wait until KDE4. guess a database is needed for this, so KDE has to adopt a database, or store this info in alot of seperate files - which only works with normal performance on ReiserFS4.