Linux Command Line Trick: Find All Files With Specific Keyword In Title
I’m currently learning some cool command line tricks, so I wanted to share.
To find all files in the current directory (and sub-directories) that have a specific keyword in the title, simply type the following into your command line:
$ find . -name '*keyword*'
Here is a more comprehensive example if you want to test this out from your command line:
#clone this directory (or whatever directory you're working with) $ git clone https://github.com/sharksforcheap/CLI-Obstacle-Course #go into the new CLI-Obstacle-Course directory $ cd CLI-Obstacle-Course #find all files in the directory that have the word "controller" in the title $ find . -name '*controller*' #results ./animals_controller.rb ./app/assets/javascripts/people_controller.rb ./app/controllers ./app/controllers/application_controller.rb ./app/controllers/static_pages_controller.rb ./app/mailers/schools_controller.rb ./app/models/cars_controller.rb ./test/functional/animals_controller_test.rb ./test/functional/cars_controller_test.rb ./test/functional/people_controller_test.rb ./test/functional/schools_controller_test.rb ./test/functional/static_pages_controller_test.rb