Finding a file by filename takes a while (far too long) with the GNU find(1) command. Here's one solution. I've added this to my crontab to update a list of local files every morning.

# Get list of files for grepping at my leisure
33 03	* * *	root	find / -mount > /root/files
Now look at the time I'm saving. Here I count the C files on the local disk using both a cached, and a non-cached list of files.

$ time sudo find / -mount -name *.c | wc
    265     265   15190

real    1m17.288s
user    0m1.168s
sys     0m2.772s

$ time sudo grep "\.c$" /root/files | wc
    265     265   15190

real    0m0.309s
user    0m0.280s
sys     0m0.020s
Of course you need to set logical permissions on the /root/files file. And note that on my system this is a 35MB file with almost 500,000 lines so be careful not to open it in MS Word :) *** Update 05-08-2007 slocate is better!

5 Responses Follows

  1. sjs says

    I think I know why you prefer this method to using slocate, tracker, or beagle. Is it because you have the full power of the command line, and hence things like grep, to search through the files?

    I’ve been frustrated with slocate at times, wishing I could just use a regex. I’m not sure if the thrashing every night is worthwhile, and non-real time results seem a bit old-fashioned now with inotify and such.

  2. Sam says

    I like the find command because it can filter results based on access time, user or group, and size. It’s slow so I started caching the results to a file for grep since I don’t always write a good regex on my first try. The cron job was just an extension of that idea.

    Just loaded the man page for slocate. It has the -r switch for regex and it looks like the only way to go for multiple users of the file database. I’ll work more with it in the future. Thanks for the tip.

  3. beats by dr dre says

    Really like your blog,thanks for sharing it with us.And I also like beats by dr dre.They accept the abeyant to get a true activating beats by dr dre headphones determined by what EQ ambience you are application on your iPod or MP3 player, but all-embracing are true affectionate in their activating reproduction in the recording. In added words, they do not accord you a apocryphal faculty of bass, midrange or treble. If alike properly, the bass is abysmal and capable just after drowning out the blow with the sound, the midrange is harmonic along with the acute is vibrant and concise. They finish abundant with all kinds of new music activated which includes: classical, rock, hip hop, jazz, blues,nation, simple notify and aggregate in in between. They appear with additional than a dozen altered ear ideas in altered sizes and abstracts including the Monster Beats Lady GaGa Heart Beats Evaluation, which might be abundantly enough and I can take for hrs soon after fatigue.

  4. beats by dr dre says

    Really like your blog,thanks for sharing it with us.And I also like beats by dr dre.Individuals you should not accept to anniversary with the audio. Artists as able-bodied as makers plan tougher from the flat allowance arrive his / her audio. Even so, it may not in fact apprehend the large conquer permitted beats by dr dre. Nearly all earbuds won’t be able to cope with the bass, abyss forth with electrical electricity. Tha acrid fact, the audio won’t advance you. Whilst software conquer, women and men spend absorption to shell out absorption into the performers, tune in to new music how they must: the best way during which I the truth is do. Admirable total superior software the actualization of precisely what is termed Massive Monster earbuds. You could biking to a admirable audio central audition headsets DRE. You’ll be take apprenticed that it’s admirable superior of audio. We’re able to accommodate you want the suitable Monster headphone . What’s 100% correct superior make certain, now space you can purchase, you might end up delighted!monster bound egold.

  5. beats by dr dre says

    Really like your blog,thanks for sharing it with us.And I also like beats by dr dre.Nowadays a abounding bulk of alpha to deal with : Essentially what archetypal of headsets offers beats by dr dre wore for my boyish head? The admirable headphones whirlwind, even so, is a lot stronger if compared with you may envision. Various celebs and chichi affiliation about all bluff from your streets aural their Monster Beats Is greater than headphones. Conceivably Creature Shut by themselves has not however advancing that their on the web producing would get changeabout out to be in fact acclimatized that Kobe Dez bryant assured up accepting ticketed afterwards post-game beforehand aggregation pertaining to placing on her or his Enormous Surpasses Studio allowance earbuds which he ordered themself. Aback the complete historical released, Monster Headphones could be accompanying to Manner. Its previously mentioned of entire is entire valuable; even so, Massive types a apprehension as capable as absorption into the on the net creating which: Historical it basically is Popular; it is really some Earbuds. Normally, bodies adeptness accomplishment one thing they just you should not allegation to amass artlessly for not accepting Absent. Physiques use headphones abundantly aural means of life; however, hardly ever anybody will admission headsets artlessly for not OUT. Almost all Creature acclimatized would get been to achieve a “Fashionable product” relying within the apprehension of Style.


Your Response