Thank you for the opportunity to help you with your question!
We find files with Name Containing String i have been searching for a command that will return files from the current directory which contain a string in the file name. I have seen described and find commands that can find files beginning with something first_word* or ending with something *.jpg.
If we have tens and thousands of text files on any Linux or Unix based server. Finding and locating those files can be done with the find command. Unfortunately find command cannot look inside a text file for a string. You have to just need to use the grep command. The grep command searches the given input FILEs for lines containing a match or a text string.
grep command syntax:
The syntax is:
grep "text string to search” directory-path
grep [option] "text string to search” directory-path
grep -r "text string to search” directory-path
In this example, search for a string called 'redeem reward' in all text (*.txt) files located in /home/tom/ directory, use:
$ grep "redeem reward" /home/tom/*.txt
$ grep "redeem reward" ~/*.txt
To finding files containing certain strings under a directory [duplicate] case:
we tried "gerp "apple"" but it search for all the files in my Ubuntu system which takes a long time.