Currently most of the Linux distributions are integrated with a series of GUI tools developed for the action of searching for files , but when a new user or someone without sufficient experience accesses a Linux system, it can be in trouble for this type of actions. One of the best free tools to search files completely in Linux is CatFish, which is based on most of the console tools available for searches such as find, locate, tracker, doodle and more..
When we are system administrators, file search execution is vital in order to perform our work effectively. Developing with Linux systems can be something without more complications for the more experienced but perhaps for newcomers it is an arduous task. Therefore, the CatFish tool will help us graphically find the files we are looking for by different filters.
With CatFish it will be possible to search for files or folders by name, date, between a range of dates, hidden files, and supports the visualization of the files, this is a free software project and uses the GPL v2 license version.
Let's see how to use CatFish to locate files with special text in Linux..
Install and use CatFish to search for text files in Linux
Step 1
CatFish can be installed from the Ubuntu Software Center or from the terminal by running the following command:
sudo apt install catfish
Step 2
Once CatFish is installed, we access it from the search engine and the first step to take will be to click on the gear icon and activate the “Search in file contents†box:
Step 3
With this option active, we will go to the terminal and execute the following syntax for searching files with special text:
find ./ -type f -exec grep -l "text to find" {} \;
Step 4
In this case we will look for the following:
find ./ -type f -exec grep -l "TechnoWikis" {} \;
Step 5
In this example, the find command will search for files starting from the current directory, "./", but we can specify the path to search. The "-type f" option tells CatFish to search only for files and exclude directories, also, we can search only for a certain type of files, for example:
find ./ -type f -iname "* .txt" -exec grep -l "TechnoWikis" {} \;
Step 6
In this case, the -exec option calls the grep tool so that each of the matching files is ready to verify its content, and if the text is in the file, its name will be reflected in the output, thanks to the option -l. It will also be possible to use only the grep tool like this:
grep -iRl "TechnoWikis" ./
Step 7
The parameters used are:
-i
Indicates that the uppercase or lowercase text is ignored.
-R
Refers to recursive file processing
-l
Indicates "Show the name of the file, but not the result itself."
Step 8
From the CatFish application itself it will be possible to search for the files with a unique text, for this it is enough to enter the desired text in the upper field and we will see the following:
Step 9
There we found each match with details such as:
With this practical tool it will be simple to find files with certain text in Linux.