I find (pun not intended) the locate command very painful, it rarely produces anything useful when I use it and its command line options don't seem to help very much.
First problem is that by default it returns every single file that has the search expression in its path, so if I search for 'home' for example I get thousands and thousands of lines returned because it lists every sub-directory and file under /home. Surely it would be more useful if it just returned /home plus any files (or other directories) actually called 'home'. As it is the default is nearly always not what one wants.
Secondly I want a search for 'home' to return files and directories called 'home', not ones called 'homeAndAway' or anything else with 'home' in them. If I'm searching for something which has 'home' in it then I'll search for '*home*'.
I know there are ways of getting over the above two problems but IMHO the syntax to do so is a bit clumsy and inconvenient. The man page gives the syntax (in the only example it gives, maybe suggesting others have the same complaints as I do) :-
locate -b '\home'
Finally I want some way to exclude large chunks of my system from the search (or to *include* specific areas), my short-term backups are on my desktop system under /bak. As a result locate finds dozens of hits for any file which happens to be in the incremental backups.
If only locate worked the same way as find does, find does almost exactly what I want most of the time (but is very slow of course because it's not got a cron built database).
I guess I'm going to write a custom script round locate that makes it produce results much like find, but quickly. I'm just wondering if someone happens to have done it for me already.
On 9 January 2012 17:34, Chris Green cl@isbd.net wrote:
I guess I'm going to write a custom script round locate that makes it produce results much like find, but quickly. I'm just wondering if someone happens to have done it for me already.
I wonder what happened to the Beagle-Project.... wouldn't that be exactly what you want?
Regards, Srdjan
On 09/01/12 20:33, Srdjan Todorovic wrote:
On 9 January 2012 17:34, Chris Greencl@isbd.net wrote:
I guess I'm going to write a custom script round locate that makes it produce results much like find, but quickly. I'm just wondering if someone happens to have done it for me already.
I wonder what happened to the Beagle-Project.... wouldn't that be exactly what you want?
Regards, Srdjan
Isn't Zeitgeist a replacement for Beagle in Gnome and Ubuntu?
http://gnomejournal.org/article/70/an-introduction-to-gnome-zeitgeist
I dunno how easily you can interrogate the database though.
I don't now if it's any better, but I think you can use find rather than locate, but I've not really tried either.
Steve
On Mon, Jan 09, 2012 at 10:28:27PM +0000, steve-ALUG@hst.me.uk wrote:
On 09/01/12 20:33, Srdjan Todorovic wrote:
On 9 January 2012 17:34, Chris Greencl@isbd.net wrote:
I guess I'm going to write a custom script round locate that makes it produce results much like find, but quickly. I'm just wondering if someone happens to have done it for me already.
I wonder what happened to the Beagle-Project.... wouldn't that be exactly what you want?
Regards, Srdjan
Isn't Zeitgeist a replacement for Beagle in Gnome and Ubuntu?
http://gnomejournal.org/article/70/an-introduction-to-gnome-zeitgeist
I dunno how easily you can interrogate the database though.
As I understand it (having looked at the web page) Zeitgeist just records what you have done and lets you find things related to that. Since I do a lot remotely via ssh connections I doubt very much if that would even get noticed.
I just want an efficient file/directory finder, like find but faster.
I don't now if it's any better, but I think you can use find rather than locate, but I've not really tried either.
Yes, find works as I want, but is painfully slow if you're searching a big filesystem. E.g. it's usable for searching, say, the whole of /home/chris but begins to get too slow for /home.