List of file names containing a given text
First of all, I believe you have used -H
instead of -l
. Also you can try adding the text inside quotes followed by {} \
.
find / -type f -exec grep -l "text-to-find-here" {} \;
Example
Let's say you are searching for files containing specific text "Apache License" inside your directory. It will display results somewhat similar to below (output will be different based on your directory content).
bash-4.1$ find . -type f -exec grep -l "Apache License" {} \;
./net/java/jvnet-parent/5/jvnet-parent-5.pom
./commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.pom
./io/swagger/swagger-project/1.5.10/swagger-project-1.5.10.pom
./io/netty/netty-transport/4.1.7.Final/netty-transport-4.1.7.Final.pom
./commons-codec/commons-codec/1.9/commons-codec-1.9.pom
./commons-io/commons-io/2.4/commons-io-2.4.pom
bash-4.1$
Remove case sensitiveness
Even if you are not use about the case like "text" vs "TEXT", you can use the -i
switch to ignore case. You can read further details here.
Hope this helps you.