Software for text search in files
Solution 1
There is a very nice one that shipped with Ubuntu out of the box until 16.04. For modern releases, read the update below!
-
Open the Dash (Super key or the Ubuntu button) and begin typing until you find
Search for Files
-
The above is for Unity, the default Desktop Environment in Ubuntu. In menu-driven environments, go to
Applications
->Accessories
->Search for Files
-
Expand the
Select more options
section and enter the text to search for in theContains the text:
input field.
Features:
- 100% GUI
- You can search for file names or content
- It does look in sub-folders.
Given your scenario (no terminal commands, simple to use interface) I think theres no better option.
PS: on the Contains the text:
input field the '.' character is a wildcard. To escape it you have to use '[]'. E.g.: type Contains the text: [.]myFunction
to search for .myFunction
UPDATE: Gnome Search Tool was unfortunately removed from Ubuntu on early 2018. For Ubuntu 18.04 onwards there's mate-search-tool
, from the mate-utils
package, that looks and behave exactly like the defunct Gnome tool:
sudo apt install mate-utils
mate-search-tool
However, its associated .desktop
launcher does not show by default in Gnome/Unity menu, but a simple edit can workaround that:
sed '/^OnlyShowIn/s/^/#/' /usr/share/applications/mate-search-tool.desktop \
> "$HOME"/.local/share/applications/mate-search-tool.desktop
Solution 2
use
grep -nr <your text> .
put the text that you want to find inside the <your text>
Solution 3
I am a fan of searchmonkey (GPL, free, cross-platform, pretty light on resources and very fast).
Solution 4
GUI (Graphical) tool:
gnome-search-tool
you can find it in Ubuntu main menu
Menu -> Accessories -> Search for Files
or run it using hot key ALT+F2
Solution 5
you can use
find . -name '*.*' -exec grep -Hn 'text to find' '{}' \;
-name '*.*' or '*.txt' (use file mask here)
'text to find' (place text you want to find here)
find . -type f -exec grep -Hn 'text to find' '{}' \;
if you want to search all files
Related videos on Youtube
![Santosh Linkha](https://i.stack.imgur.com/zuvbs.jpg?s=256&g=1)
Santosh Linkha
Updated on September 17, 2022Comments
-
Santosh Linkha almost 2 years
I am looking for a software that will search text in files from a folder similar to XYplorer.
Is there something similar?
-
Admin over 13 yearsDoes it have to be a GUI tool?
-
Admin over 13 years@Octavian yes it has but even there is not, it will work for me
-
Admin about 6 yearsPossible duplicate of How to search for strings inside files in a folder?
-
-
Santosh Linkha over 13 yearsdoes it look in sub folders
-
Santosh Linkha over 13 years
experimentx@workmateX:/var/www/testingzedn$ grep -nr application.ini
is taking forever ... am i incorrect -
wizztjh over 13 yearsneed the dot . , it will look into the folder with the -r
-
wizztjh over 13 yearsgrep -nr application.ini .
-
Lekensteyn over 13 yearsFor all files, do not use
-name '*.*'
as files do not always have an extension. Use-type f
instead (for searching in all files). Replace{}
by"{}"
, otherwise file names with whitespace in it do not get searched correctly. -
Mikl over 13 years@Lekensteyn i have edited my post. but i made some test with files with whitespaces in names and no error while using {} witout quotes.
-
Santosh Linkha over 13 yearsyup, I didn't see i could add details
-
MestreLion over 13 yearsyes, you can... just click on "select more options" and you can have not only "Contains the Text" but also tons of other search options (date, user, file sizer, even regex expressions). I also missed this little beast for a long time... i wish it was integrated into Nautilus (kinda like F3 in Windows Explorer)
-
Lekensteyn over 13 yearsjust tested it too and you are right, whitespace is not a problem. In some shells, the quotes might still be necessary to prevent shell expansion. From
man find
: "Both of these con‐ structions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell." -
Mikl over 13 yearsthis is the same as i advised earlier
gnome-search-tool
-
MestreLion over 13 years@Octavian: Thanks for providing the screenshots!
-
MestreLion over 13 years@Mikl: its the same result, the difference lies in approach on how to invoke it: your initial solution was focused on command-line invocation (or ALT+F2) and only briefly mentioned it could also be found on menu. Didnt say where, or what the program name was in the menu. Only after i post my answer you edited yours to provide the menu path and name. For newcomers, a Menu-oriented approach is always better than CLI invocation. ALT+F2 should only be used when the software is not avaliable in menu.
-
Amol Gawai almost 12 yearsLooks good. Will give it a try on other platforms since the top voted answer fits my bill on Ubuntu.
-
Amol Gawai almost 12 yearsSeems it does not work on 64 bit operating systems (I faced the problem on win 7 64 bit). This is deal breaker for me as I use 64 bit OSes everywhere. Looked promising though.
-
josircg over 10 yearsJust an update for newer Ubuntu versions: on Unity interface (Ubuntu 12 or superior), click on Dash Home (the first icon on toolbar), type "search" and select "Search Files" application.
-
Aleksandar Savkov over 10 yearsI'm not sure this tool still exists in this form after the Unity button. The answer by @wizztjh works though.
-
Aquarius Power about 7 years@AmolGawai working perfectly at ubuntu 64bit here...
-
Franva over 3 yearscould someone help to find out where is this tool please? for Ubuntu 20.04. I searched this tool, it's not there anymore. How to get it back?
-
MestreLion over 3 years@Franva: it was removed from Ubuntu since 18.04. You could use the similar
mate-search-tool
:sudo apt install mate-utils
-
Franva over 3 years@MestreLion thanks for letting know. I went with SearchMonkey and it looks good as well :) have you tried to compare these 2?
-
MestreLion over 3 years@Franva, nope, never used SearchMonkey. Gnome/Mate Search Tool is fine for me as a simple find GUI, for anything more complex I prefer using
grep
andfind
directly on terminal -
MestreLion over 3 years@Franva: Also, I usually tend to avoid software that's not in the repositories. SearchMonkey in particular does not even have a .DEB installer yet. It seems the project was inactive for 10 years , still uses GTK2, and was revived in 2018 (possibly due to Gnome Search Tools being deleted from Ubuntu). Hopefully they'll migrate away from SourceForge to a proper GitHub hosting, and re-active their currently suspended website. They have a lot of catching up to fill this 10-year gap of inactivity.
-
Franva over 3 years@MestreLion good point. thanks :)