FOSSPicks
Command-line search
codespelunker
The fzf
fuzzy finder has changed the way many of us search for things from the command line. In particular, it helps when you can't remember exactly what it is you're looking for or can only remember a certain path. It works well on its own like this, but it works much better when it's integrated into your a shell for file and history search, or within an editor such as Vim for searching documents. Codespelunker, run from the command line as cs
and easily installed via go install
, is another great alternative and is better suited to finding things within files without resorting to piping things through grep
. This is because it's more like both a Google search and search result page embedded into your console for local searching, and, as with Google, it's the perfect solution when you can't remember exactly what it is you're looking for.
Codespelunker will search through the contents of any text file located at or below your current file system location. It's been designed to work best with code, but it's equally happy with any text. It does this live, rather than caching an index, and yet remains incredibly quick and reactive. The TUI-based command-line user interface also makes it easy to use. Typing cs
on its own will open the interactive search, which is a little like fzf
for the contents of your documents. Typing a search term will start to display results and you can use a rank
command to adjust the order they're listed while you're within the search. Rather than typing cs
on its own, you can provide a search term as an argument, and the non-interactive output will list the results with the search terms highlighted. There are options for exact searches, fuzzy searches, and negating two searches with NOT
. You can even use regular expressions, and there are further arguments for including and excluding directories. It works brilliantly, and is significantly easier to type than cat | grep | fzf
.
Project Website
Ebook reader for e-readers
Buy this article as PDF
(incl. VAT)