Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

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

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

1 Answer 1

up vote 10 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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