How to search inside files in linux

To search within files we can use the command grep (man grep). Basic usage is as follows:

grep -Ril "mail" /var/www/

This will search our web root folder (/var/www/) for any text with the word ‘mail’ inside it.

  • R – Recursive
  • i – uppercase/lowercase
  • l –  Show file name instead of actual location

You may also like...

Leave a Reply