How to find particular string in multiple files

Hello friends,

I have find a paticular string from the files present in my user
for example:

a username and password is hardcoded in multiple files which present in the my user.so I have to search about username in which files it is available.there are several dirctories are there,so now iam looking manually can u help through find command.

Advance thanks ,
Siva Ranganath Ch:)

find . -type f -exec grep -l "USERNAME" {} \;

With it, you can find out which files under current folder (include subfolders) include the string USERNAME

Thanks for reply.
the following error is coming:

find: cannot open .-type: No such file or directory
find: cannot open f: No such file or directory
will please let me know any other alternative is there.:slight_smile:

.-type

there is a space between . and -type

1 Like

Hello
Thanks for quick reply.

I want a bit clear ,it was showing like below.
./.subversion/servers so how can i go to that path.

Thanks in Advance.
I am waiting for ur reply.:slight_smile:

Do you mean how you can change to that directory ? You use the cd command.

cd ./.subversion/servers

tyler_durden