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

https://github.com/boyter/cs

If search results on the command line aren't enough, cs also offers an HTTP mode you can use locally through a web browser.

Ebook reader for e-readers

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Tracktion T6

    The Tracktion digital audio workstation is finally taking off as it reaches version 6.

  • FOSSPicks

    This month Graham reviews PeaZip, LibreSprite, NeoChat, Beaker, Giada, Thrive, Kurve, and much more!

  • FOSSPicks

    Graham looks at TreeSheets, rare, McFly, b2, DrumGizmo, A/B Street, Xmonk, and much more!

  • Audacity 2.1

    The Audacity free audio editor is evolving from a hobby app into a professional sound tool.

  • FOSSPicks

    This month Graham explores Carla, digiKam 7, NoiseTorch, diskonaut, Surge 1.7, Trigger Rally, and more.

comments powered by Disqus