How can you find files name 'xyz' under directories name 'abc'?

something like this....but its not working.

find . -type d -name 'abc' -exec find {} -type f -name 'xyz' \;

find . -not -path 'abc' -prune -o -type f -name 'xyz'

I can't just find files based on their name alone, b/c multiple directories NOT named 'abc' will have a file w/ the name 'xyz'

  • think I actually got it. find . -type f -name "xyz" -path "abc" – veilig Aug 5 '14 at 0:37

I think you could do

root@localhost:~# find /home/ -type f -name 'authorized_keys' -path '*/.ssh/*'


  • .ssh is your directory abc
  • authorized_keys is your file name xyz
  • /home/ is your starting directory .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.