I want to find a text file in my hard disk which contains a specific word.
Prior to Ubuntu 12.4 I used to start in the dash an application, I think it was called "Search for file...", whose icon was a magnifying glass.I can't find that simple application any more.
You can use the
grep
command from terminal:This command will find all occurrences of "word" in all the files under the current directory (or subdrectories).
Install gnome-search-tool.
Open
Search for files
selectSelect More Options
andHere's an overview of different methods that one can use for searching files for specific strings of text, with a few options added specifically to work only with text files, and ignore binary/application files.
One should note,however,that searching for word can get a little complex, because most line-matching tools will try to find a word anywhere on the line. If we're talking about a word as string that could appear in the beginning or end of line, or alone on the line, or surrounded by spaces and/or punctuation - that's when we'll need regular expressions, and especially those that come from Perl. Here, for example, we can use
-P
ingrep
to make use of Perl regular expressions to surround it.Simple grep
-r
for recursive search down from current directory-I
to ignore binary files-H
to output filename where match is foundSuitable for searching only.
find + grep
find
does the recursive search part-I
option is to ignore binary files-H
to output filename where line is foundgood approach for combining with other commands within subshell, like:
Perl
poor-mans recursive grep in recursive bash script
This is the "bash way". Not ideal, probably no good reason to use this when you have
grep
orperl
installed.Question is quite old... anyway... currently (2016) there is a gnome app called
tracker
(you can find it in ubuntu repositories) that can be installed to search for text inside files (tried odt-ods-odp-pdf). The package comes with 4 other packages to be installed (tracker-extract, tracker-gui, tracker-miner-fs, tracker-utils) Namastè :)Yes, I know you was looking for gui application and this is old post, but maybe this help someone. I found ack-grep util. At first install it via
sudo apt-get install ack-grep
and then run commandack-grep what_you_looking_for
in the directory where you want search. This show you all files in which is your text and also show preview from this files. And this is so important for me.You can specify wildcards in case if you want to search in specific files.
For example: If you want to to find what are all *.conf files those have word
SSLCertificateFile
in them, you can run this on root:Even simpler and faster is "silver searcher"
sudo apt-get install silversearcher-ag
. Take a look at https://github.com/ggreer/the_silver_searcher for reassons on why it is better than ack* among others.