Let’s face it, when you are in the middle of developing your most recent genius idea, there are times you just need to find every instance of a function being used. For this, we can revert to the ‘find’ and ‘grep’ commands to narrow things down a bit. First, a little bit about the tools we’ll use:

Pipe, |

The pipe or | character is used to join command line requests into a single input and output. We’ll be using it to start the find command, look for an occurring, and avoid a negative case…all on the same data set.


The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria. You can search for files by name, owner, uhoup, type, permissions, date, and other criteria. The search is recursive in that it will search all subdirectories too. In our case, we’re going to be looking at all files from the current directory and all sub-directories. This is noted by the period character ‘.’


We will be using the ‘xargs’ command to build and execute command lines from standard input.


Grep is used to print lines matching a pattern. In our case we’ll be using the basic usage, as well as the ‘-v’ flag, for inversing the match. In this case, I use it to avoid any occurrences of the search term in a .svn folder.

So on with the commandline. So, I would like to search for all instances where my current project uses the ‘foo’ function:

Post Promoter Pro

Posted by Chris Klosowski

Hi, I'm Chris Klosowski. Currently I am a Lead Developer of Easy Digital Downloads, where we build the easiest way to sell digital products with WordPress. I am also the person behind Post Promoter Pro, the most effective way to promote your WordPress Content.

Leave a reply

Your email address will not be published. Required fields are marked *