How can I locate all files in directory /home/user/example that contain "some text" in Linux. I am using Ubuntu 9.10.
Tell me more
×
Super User is a question and answer site for
computer enthusiasts and power users. It's 100% free, no registration required.
|
I usually use a combination of find and grep so it grabs all hidden files as well: find /home/user/example -type f -exec grep -i "some text" {} +
The |
|||||||||||
|
Will recurse through all sub folders looking for the string. |
|||
|
|
|
If you're not worried about recursing into subdirectories,
Will only output the filenames, and not the context that the match appears in. |
|||