I need to find the folder names along with the file names which has my string in their contents. I am in this directory "/data/queue/data" and I have lot of folders in the same directory and inside those each folders, I have various files.
I want to run a command which can find me folder name and the file names which has a particular string like this "badezimmer" in their contents. What is the fastest way to do this?
Below are the folders in this directory "/data/queue/data" and each of those folders has various files in it.
david@machineA:/data/queue/data$ ls -lrth
drwxr-xr-x 2 david david 12K Apr 11 18:58 1428800400
drwxr-xr-x 2 david david 12K Apr 11 19:58 1428804000
drwxr-xr-x 2 david david 12K Apr 11 20:58 1428807600
I want to run a command from this directory only - "/data/queue/data" which can print me the folder names and the files names for that folder if they have my string in their contents.
david@machineA:/data/queue/data$ some command to find the folder and files which has my string.
find /data/queue/data -name *badezimmer*? Or are you talking about files containing the string in their contents?grep -rl badezimmer /data/queue/datawill work.grep -rl "A B" /data/queue/data. Right?