Find files containing search terms on Ubuntu

By Lowell Heddings on September 11th, 2006

To find files containing keywords, linux has a powerful command called grep, which you can use to find the lines inside any file or a list of files. I use this very often to find a function declaration in a set of php files that I’m unfamiliar with.

Let’s say we are looking for the definition of a function called wp_content_filterize, and we don’t know where to start. Let’s try using grep…

grep -i -n ‘function wp_content_filterize’ *

We should see the output right on the console

functions.php:18:function wp_content_filterize($thefilter) {

Now we know that the function definition is found in the file functions.php, on line 18.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/11/06
More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!