Enhanced searches with fzf

Command Line – fzf

© Photo by Timothy Eberly on Unsplash

© Photo by Timothy Eberly on Unsplash

Article from Issue 268/2023

Simplify your searches and get better results with fzf, a modern search tool based on fuzzy logic.

Search commands have always been essential to using computers. With the increased storage capacity of modern systems, they are more important than ever because there is more material to search. In fact, searches are so important that alternatives to time-honored commands are becoming increasingly common. One of the most effective of these recent alternatives is fzf, a command-line "fuzzy finder" [1].

For most Linux users, the basic search tool for finding directories and files has been find, which is most effective when you know exactly what you are looking for. If you do not know, then you need a way to allow variation in the output. Traditionally, variation in search tools like find is provided by regular expressions (regexes), a concept first developed in the 1950s. Regexes are standard patterns that offer different types of variations in results. Most users are familiar with the simpler regexes, such as * to mean zero or any character, so that apt* might return apt, apt-get, apt-cache, and probably many others. At a more advanced level, users might know that gray|grey produces results with either spelling, or [b-e] a range of characters. However, regexes are not consistent across applications and can rapidly become extremely complex to construct or type correctly, especially when all you want is a quick answer. For example, even with context, who can easily explain this randomly selected example:



Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

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

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Fzf/Fzy

    Fuzzy finders retrieve useful results from data streams even if there are no exact matches.

  • Tracked Down

    Searching for text in files or data streams is a common and important function. Ugrep tackles this task quickly, efficiently, and even interactively if needed.

  • Regex Generators

    As regular expressions grow in complexity, regex generators can make the job easier by computing the patterns for you.

  • agrep

    The agrep tool expands on grep by adding fuzzy search capabilities to text string-matching operations.

  • Command Line – tre-agrep

    Tre-agrep has all of grep's functionality but can also do ambiguous or fuzzy searches without deep knowledge of regular expressions.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.