6

If I'm in the root directory, can I use find to search all the directories below it for a file?

I tried find stdio.h but it didn't find anything. However I know that that file is in the filesystem somewhere. How do I find it?

migrated from stackoverflow.com Nov 22 '09 at 17:32

This question came from our site for professional and enthusiast programmers.

11

It's in /usr/include/stdio.h, but for future reference run

$ locate stdio.h

Don't forget to run updatedb first. On Cygwin, you'll want to run it as Administrator.

To look in the current directory and its children:

$ find . -name stdio.h

To look everywhere beneath the root directory:

$ find / -name stdio.h

You tagged this as a Cygwin question, so to search the entire C drive, you could run

$ find /cygdrive/c -name stdio.h

but that's likely to be much slower than searching from an Explorer window.

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.