Linux Command Line Trick: Find All Files With A Specific Word Inside

Still learning command line tricks! Here is a great CLI cheatsheet to reference.

To find a file witha  specific keyword in it, simply enter the following into your command line:

  $ grep -r "keyword" * 

Here is a more comprehensive example if you want to test this out:

# clone this directory (or do this within whichever directory you're working with)

$ git clone

# go into the new CLI-Obstacle-Course directory

$ cd CLI-Obstacle-Course

# find all files with the method name "bootinator" in it
$ grep -r "bootinator" *

app/assets/stylesheets/application_helper.rb: def bootinator(name)
Then the distressed file said

Then the distressed file said

Then the distressed file said

Then the distressed file said

Then the distressed file said

Enjoy the article? Join over 20,000+ Swift developers and enthusiasts who get my weekly updates.

  • Thank you for posting this! I googled to find the answer and your post was listed. DBC is going to have to come up with new exercises ;P