Most useful grep commands for Linux for searching and finding files:

Search inside a file for a particular word or words - for example, below command searches for all the lines that have 'Fatal error' in the file /var/log/php-fpm/www-error.log

# grep 'Fatal error' /var/log/php-fpm/www-error.log

Search for files inside a particular directory that has a particular word or words - for example, below command searches for all the files that have 'Fatal error' in the directory: /var/log/php-fpm/

# grep 'Fatal error' /var/log/php-fpm/*

Search recursively (means all files and folders) inside a directory for a particular word or words - for example, below command searches inside the public_html folder for all the files that have the address: "123 Main Street". (Based on below command, you're on your home folder and public_html is inside the home folder)

# grep -R '123 Main Street' ./public_html/

Let's say you want to do the same search as above, but exclude the "docs" folder inside public_html:

# grep -R --exclude-dir=docs '123 Main Street' ./public_html/

Let's say you want to do the same search as above, but exclude the "docs" and "spreadsheets" folder inside public_html:

# grep -R --exclude-dir={docs,spreadsheets} '123 Main Street' ./public_html/