Tag Archives: grep

Using GREP with Magento to Help Locate Files

When looking for something specific, if you’re working in Magento, it’s going to be difficult. Before I knew about GREP, I would just open every file and cmd-f till I found what I was looking for.

And then I learned about GREP.

I was looking for references to “Subtotal” on the front end, so I entered terminal, SSH’ed in, cd’ed to /app/ and entered this line.
grep -rn "('Subtotal')" .
and a long list appeared. One of the files was titled Totals.php and I knew I hadn’t modified it before. When I modified the line in that file, it did exactly what I wanted!

Long story short, don’t modify core files like I did, and use GREP to save time.