Powered By

Powered by Blogger

Kamis, 15 Oktober 2009

Searching For Text? `egrep -r foo $*` Too Slow?

Following our article on tools to find files via command line, a Web Upd8 reader decided to post a follow-up.


Searching for text? `egrep -r foo $*` too slow?

Mac OSX has Spotlight, MS Windows has Desktop Search or even Google Desktop and Linux/Gnome has Beagle. Like so many things in Unix, Beagle is faster, more powerful via the command line, and hostilely requires user configuration.

Beagled runs as a user daemon, continually updating its search index and efficiently exploits inotify, a kernel mod more powerful than other OSes, and bundled in Linux since v2.6.13, in 2005. Inotify is similar to the older FAM File Activity Monitor.


INSTALLATION

sudo apt-get install beagle         #For Ubuntu &c
sudo yum install beagle #For Fedora &c


Next, add beagled to your Gnome or X session file, or .profile. Ubuntu users can click on System -> Preferences -> Startup Applications and add it there.

Initially, beagled will keep your drive busy, until it catches up, and indexes your whole drive.

Gnome users can use and configure Beagle from the panel (system tray). Command line users can call:
beagle-query text
If you were thinking of putting beagled in /etc/profile on a multiuser system, just remember that such will bypass read restrictions for secured files / directories.


MORE

If your editor does not search source code well, try Exhuberant CTags available here: http://ctags.sf.net/

If you are sick of sed or `perl -e` for search and replace, try Rpl: http://rpl.sf.net/

If you want to search a tagged document, such as HTML or OpenOffice XML, then take a look at Ruby Hpricot sgrep Eclipse's xquery plugin: http://xqide.org/eclipse/plugin-page.php




This is a guest post from Bruce, a New York City programmer, the author of http://emacro.sf.net/.

Tidak ada komentar:

Posting Komentar