find/search text inside of files from command line - linux

grep -iRl "your-text-to-find" ./


Here are the switches:
-i - ignore text case
-R - recursively search files in subdirectories.
-l - show file names instead of file contents portions.
-n - show the line number
-w - match the whole word.

./ - the last parameter is the path to the folder containing files you need to search for your text. In our case, it is the current folder with the file mask. You can change it to the full path of the folder. For example, here is my command

grep -iRl "linux" /home/user/Documents/

Add comment


Security code
Refresh

Category: