Recently I was asked what unix utility was missing the most functionality; I answered locate, as it'd be nice if it knew about file contents.

I had been thinking about how to nicely search files and had tried mairix for my maildir'd email, and glimpse. mairix was functional, but glimpse's nightly cache rebuilds were getting ridiculously lengthly (4+ hours).

At the last HPM, NathanPowell pointed me in the direction of Beagle, which helpfully enough comes with a seperable command-line and graphical interface. Guess which one I installed? ;)

Beagle uses linux's kernel Inotify feature to receive new files to index, so there's no need to rebuild a cache, but rather only add newly added or updated files. There's a 'beagled' daemon that you just leave running that automatically takes care of this updates.

The first caveat is that the documentation says beagle indexes everything, which isn't true. It won't index dotfiles or dotdirectories. So, if you happen to have a ~/.maildir, you need to rename it before it will be indexed.

The second caveat is that beagled will probably continue to use a bunch of memory; we'll see how this impacts life on my laptop.

phaller  25402  0.1 10.9  88568 41412 ?        Sl   00:57   0:29 beagled --debug /usr/lib/beagle/BeagleDaemon.exe --bg
phaller  30316  1.1  7.7  56004 29152 ?        Sl   04:33   0:23 beagled-helper --debug /usr/lib/beagle/IndexHelper.exe

Finally, beagle outputs references in URI format, so I wrote a quick perl script to handle my command-line tossing of output to other programs:
#!/usr/bin/perl my $q = join(' ', @ARGV); open(my $fh, "beagle-query $q |"); for(<$fh>) { s#^file://## and do { print $_; next; }; print STDERR $_; } close($fh);

That's hot. I didn't realize there was a command line interface. Hmm, I suspect this will make it highly usable. - nathan