How to find particular word in directories?

Hello,

i have multiple directories on my server. i need to find specific word like lets says for e.g IPV6 from those directories. can somebody tell me the right command which will let me to that?

Go to your home directory or wherever you want to start the search,,
then use find,

find . -type f | grep "keyword" *

Your requirements are not clear.

  1. Are you looking for a file named IPV6 in a specific set of directories?
  2. Are you looking for a file named IPV6 in all directories in the file hierarchy rooted in a specific set of directories?
  3. Are you looking for regular files containing the string IPV6 in a specific set of directories?
  4. Are you looking for regular files containing the string IPV6 in all directories in the file hierarchy rooted in a specific set of directories?
  5. Or are you looking for something else I didn't guess?

thanks! no ipv6 is not a file name, it is "string" mention in many files which are spread over multiple directories. so answer to your question. # 3 and # 4 is what i am looking for?
you are right # 3 and #4 option from your questions is what i need...

Try

grep -rl "keyword" .

This will give you #4 starting from your current direcory

thanks!

So based on what senhia83 suggested, with some minor corrections:

find /directory1 /directory2 ... /directoryN -type f -exec grep -Fli 'ipv6' +

will give you a list of regular files in the file hierarchies root in the directories /directory1 through /directoryN that contain the case-insensitive string ipv6 .

hi,

i try to run the command from my home directory. but dont seem to work. may be i m missing or typo:

find . -type f -exec grep -Fli  'ipv6' + 

Ouch. Yes. Sorry. try:

find . -type f -exec grep -Fli 'ipv6' {} +