Ask HN: Instant realtime grep tool for Linux
I have been searching for an instant, real-time grep tool to search through source code on Linux but I haven't found any application that does this.
I have only found ONE ancient app only available on Windows, called Baregrep.
Is there any app like this but also available for Linux? Ripgrep? Or are you looking for something with an UI also? From what I could tell by looking at ripgrep's github page, it works exactly the same as grep. So it is not real-time as I type, search. It might be fast enough though. You haven't specified your corpus size. If your corpus is small enough, ripgrep might be instant enough. Another alternative is to look at fzf paired with ripgrep, but I imagine for large enough corpus sizes, it won't be instant. Otherwise, if you're searching something large and really absolutely need "real time as I type" as a hard requirement, then you'll not really be looking for a grep per se, but for a tool that builds an inverted index and uses that for searches. So things like Russ Cox's 'codesearch', 'qgrep', 'livegrep' and Sourcegraph. I did notice that ripgrep was noticeably faster than grep, however, I'm looking for a solution that searches through the source code as I type. Something like Fsearch but for searching through source code contents. I think for something like this even grep would be fast enough. You still haven't specified your corpus size, despite me noting how crucial it was to your question. You also haven't specified what kinds of queries you're running. If you're doing simple literal queries like 'rg foobar', then ripgrep is pretty much as fast as you're going to get when it comes to non-indexed search. It uses all your CPU cores. On Intel x86_64, it uses AVX2 to do the substring search for 'foobar'. There's just not much you can do to go faster than that in terms of latency. As I said, if you have a large corpus, then the only way to get instant search times is through an index. You haven't said why those approaches don't work for you. > I think for something like this even grep would be fast enough. Sorry I should have mentioned this before, but I'm the author of ripgrep. I know a thing or two about how fast normal exhaustive search greps can go. :-) I'm querying through ~600k lines of code. Ripgrep is very noticeably faster than grep when I'm searching. I have no complaints at all regarding the speed! The only issue I'm facing is that I wish for Ripgrep to display me the search results as I type. Similar to how FSearch does it. So instead of typing a search query and hitting enter in the commandline, I would want to continuously search as I type. I think since Ripgrep is very fast, it would be amazing for this task. Oh. You're not talking about speed. You're talking about the user interface. I don't know what FSearch is, so that doesn't help this. What you want is to pair fzf with ripgrep. There are loads of tutorials out there for how to do it. That is exactly what I was looking for! Thanks :)