Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any utility to make searches for a string inside ASCII files to avoid command line searches?

How to make a command line search, for example for the string "test" inside all files in the directory /var/x/?

share|improve this question
You really mean without using command line ? Because the best tool for that remains grep... – alci Oct 9 '12 at 8:39
up vote 53 down vote accepted

You can use searchmonkey. The tool is available in the repositories, so you can simply

sudo apt-get install searchmonkey

On the other hand, command line search with grep is really intended for that...

Here is a screenshot from searchmonkey

enter image description here

share|improve this answer
would it be ask too much to have this monkey integrated into the folder navigator? linux guys don't get it... reaching the desktop, you guys must be kidding! I use linux since madrake... and i can say that we had better in the past – neu-rah Dec 7 '14 at 0:16

I assume that your first question is about a GUI alternative to the grep command. I can't help you with that, I always find the command line very effective.

As for the command line, try

grep "test" /var/x/*

If you want to search recursively (i.e. not only in /var/x/, but also in subdirectories thereof), do

grep -R "test" /var/x/

To avoid grepping the files which grep thinks to be binary, use the -I option:

grep -I "test" /var/x/

If grep thinks a file is binary (based on first few bytes of the file), it will assume it does not match instead of going through the whole file.

share|improve this answer
Will it work if the folder contain some non-ascii files? – Anwar Shah Oct 9 '12 at 8:47
Well, grep will also try search for the string in a binary file, and report it if it matches: Binary file file.jpg matches – January Oct 9 '12 at 8:49
but it may take a long time which is unnecessary – Anwar Shah Oct 9 '12 at 8:51
@January When a binary file is read as text, it often has extremely long "lines" (because a character or character sequence that would be interpreted to designate the end of a line may not appear for a long time, or ever). Depending on the way a text search utility is implemented, this could cause performance problems if each "line" is read fully into memory and then checked to see if it matches the search string (which is a reasonable way for grep to be coded, though I don't know if Ubuntu's grep is written that way). – Eliah Kagan Oct 9 '12 at 9:30
There should be a * after the final slash in the path or grep does not appear to do any work in 14.04 – DavidScherer May 19 at 13:35

You can use regexxer it is a great GUI search/replace tool for regular expressions.

you can download by:

sudo apt-get install regexxer

enter image description here

share|improve this answer

Unfortunately grep does a very poor job of searching inside Word (.doc) files, but you can pipe catdoc output into grep. I'm no programmer but this little script works well for me:

export GREP_OPTIONS='--color=auto'
echo -e "\n
Welcome to scandocs. This will search .doc (NOT .docx) files in this directory for a given string. \n
Type in the text string you want to find... \n"
read response
find . -name "*.doc" | 
while read i; do catdoc "$i" | 
grep -iH --label="$i" "$response"; done

All improvements and suggestions welcome!

share|improve this answer
This question was about graphical applications and plain text files. I'm not sure what grep and .doc have to do with the question. – Andrea Corbellini Jan 26 '13 at 14:54
Seems OK, see January's detailed answer about grep. – aquaherd Jan 26 '13 at 14:58

Try Recoll, best GUI one I ever used, you can get it here:

share|improve this answer

You can use the grep command from terminal:

grep -r string *

This command will find all occurrences of "string" in all the files under the current directory (or subdrectories).

For hidden files, you can use:

grep -r string ..

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.