How to Do a Fuzzy File Search in Linux

This tutorial is about How to Do a Fuzzy File Search in Linux. Recently I updated this tutorial and will try my best so that you understand this guide. I hope you guys like this blog, How to Do a Fuzzy File Search in Linux. If your answer is yes after reading the article, please share this article with your friends and family to support us.

Check How to Do a Fuzzy File Search in Linux

Fzf is a general command line tool to search for fuzzy characters. It is similar to grep. It is a cross-platform command line tool that helps you quickly find and open files. Furthermore, it is open source, portable and has no dependencies.

Supports Vim/Neo vim plugin, keyboard shortcuts and fuzzy autocomplete. It can be used with any list: files, command history, processes, hostnames, bookmarks, Git commits, etc.

How to do a rough file search in Linux

  • People who are used to a command line environment are probably familiar with the concept of Unix filters. This is when several independent utilities are put together in a pipeline to produce the desired result step by step. For example, this pipeline produces a list of strings:
    • $ yes | head -10 | awk ‘{ print NR, NR % 2 == 0 ? “Odd Couple” }’
    • 1 odd2 even3 odd4 even5 odd6 even7 odd8 even9 odd10 even
  • Each program acts as a filter. In simple terms, fzf is just another Unix filter. It reads lines from stdin, launches an interactive browser dialog, and finally writes the selected items to stdout. The key point, and difference to tools like GNU find, is its interactive Finder dialog that instantly filters items as you type.
  • It might not sound too practical so far, but the main use case for fzf is to search for files on the command line. With fuzzy matching and instant feedback, you’re just a few characters away from finding the right file, no matter how far you’re lost in the directory hierarchy. No need to go back to your file manager, traverse the directory hierarchy, copy the path of a file, and paste it back into the shell. Compare the “file manager” and “fzf” workflows below.
  • fzf supports fuzzy matching, so you can type multiple characters in a row and it will match lines with those characters scattered in the string. Alternatively, prefix a search term with a single quote, such as ‘string, to opt for exact matches only, or run it as fzf –exact .
  • It does not support regular expressions or global patterns, so the *.sh pattern would not work. But keep it simple: productivity and speed are your goal today. You don’t have free time to compose and write correct regular expressions. Instead, write multiple words, or even parts of words, delimited by a space, and that would cover more than 90% of the use cases. For the remaining 10%, use ^ and $ to match the start and end of the string respectively, and use ! to negate the match.
  • Printing selected files on a command line isn’t very useful, so searching is usually combined with some additional action. For example, you can open it with Vim or pipe the selected items to the next program.
    • # Open file in a Vimvim -o `fzf`
    • # Print information for each selected filefzf | xargs ls -l

Final remarks: How to Do a Fuzzy File Search in Linux

I hope you understand this article, How to Do a Fuzzy File Search in Linux. If your answer is no, you can ask anything via the contact forum section related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.

Editorial Staff
Editorial Staffhttps://www.bollyinside.com
The Bollyinside editorial staff is made up of tech experts with more than 10 years of experience Led by Sumit Chauhan. We started in 2014 and now Bollyinside is a leading tech resource, offering everything from product reviews and tech guides to marketing tips. Think of us as your go-to tech encyclopedia!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related Articles

Best Telemedicine Software: for your healthcare practice

Telemedicine software has transformed my healthcare visits. It's fantastic for patients and doctors since they can obtain aid quickly. I...
Read more
I love microlearning Platforms in today's fast-paced world. Short, focused teachings that engage me are key. Microlearning platforms are great...
Think of a notebook on your computer or tablet that can be changed to fit whatever you want to write...
As of late, Homeschool Apps has gained a lot of popularity, which means that an increasing number of...
From what I've seen, HelpDesk software is essential for modern businesses to run easily. It's especially useful for improving customer...
For all of our important pictures, stories, and drawings, Google Drive is like a big toy box. But sometimes the...