I am working on a project that has a series of files in R and R Markdown, and I need to track down where a particular function was originally defined. In Unix based systems, this is pretty easy to do.

There’s a built in function, grep, that does the job. So

grep “string” *.*

will find and list the occurences of “string” in every file in your current directory. There are lots of variations, type

grep –help

for details. The real computer nerds already know this, but I’m just getting started with Unix based commands.

This Blog post was added to the website on 2016-02-16 and was last modified on 2020-01-19. You can find similar pages at Statistical computing.

An earlier version of this page appears here.