Live data from Hacker News

ffind: a sane replacement for command line file search

wrongsideofmemphis.com

11–20 of 40 posts

Re: ffind: a sane replacement for command line file search

#12
post #8

I looked into his python implementation, I thought he would just translate the parameters and call find, but he instead did go to implement the search algorithm. Wouldn't that make it a bit slower than the original find?

File system traversal can be quite slow on traditional hard disk drive, it requires a lot of random disk access which has much higher latency than sequential access (think about the moving parts in the disk drive). So I guess that being written in Python is hardly the bottleneck if the disk reads have not been cached by the kernel.

Re: ffind: a sane replacement for command line file search

#15
post #7
post #5

Alternatively, you may just install locate . It won't examine file contents, but it works in the common cases. It's also blazingly fast because it's indexed.

Its problem that you always have to update the index, which can be problematic in fast changing systems (and quite slow in some cases). The greatest disadvantage is that you need root rights to update the index.

You can have arbitrary indices being created by arbitrary users. The database(s) that is(are) used by the locate command can be specified by command-line option or by an environment variable.

Re: ffind: a sane replacement for command line file search

#18
post #3

Similarly, I have a little shell function loaded by .zshrc that covers 90% of my use cases: findit() { find . -name \* -exec grep -iH $1 {} \; }

Is this not equivalent and avoids running grep(1) once for each path?

    find -exec grep -iH ${1?} {} +
Though it still runs grep on directories.

Re: ffind: a sane replacement for command line file search

#19
post #3

Similarly, I have a little shell function loaded by .zshrc that covers 90% of my use cases: findit() { find . -name \* -exec grep -iH $1 {} \; }

Right. There's no need to write a whole new tool just to simplify invocation for common cases. For a guy who uses the command line "a LOT" he's not making good use of his shell.
Post reply on HN