This allows you to find a string on a set of files recursivly

grep -rF --include='*.txt' stringYouLookFor *
The -r is for recursive, -F for fixed strings, --include='*.txt' identifies you want all txt files to be search any wildcard will apply, then the string you are looking for and the final * to ensure you go through all files and folders within the folder you execute it.
Sample Output
maxleonca@lab:~$ grep -rF --include='*.txt' Tel *
apartamentos.txt:Tel?fono de habitaci?n: 2582-0391
apartamentos.txt:Tel?fono del celular: 8815-7608
Documents/RubyStart/vendor/rails/railties/doc/guides/source/security.txt:-- _Tell Rails not to put passwords in the log files._
Documents/RubyStart/vendor/railties/doc/guides/source/security.txt:-- _Tell Rails not to put passwords in the log files._
Documents/gutierrez_gongora.txt:Horarios y N?meros de Tel?fono
Documents/gutierrez_gongora.txt:Tel?fonos: 2225-6181 / 8395-5083

By: maxleonca
2010-02-12 18:07:07

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: