-   Linux - Software (
-   -   recursively search (

basak 08-13-2006 10:20 AM

recursively search
Hi!Is there a bash shell command which recursively searches the subdirectories of a given directory to find the path of a given file?Thanks a lot:))

MensaWater 08-13-2006 10:25 AM

You can do:

cd <directory>
find . -name <filename>

This will recursively look through the directory for the file you want. You don't really even have to cd there first. The dot (.) says "this directory". You could instead just type:

find <directory> -name <filename>

That would tell it to search recursively through the specified directory (e.g. find /var -name mqueue would find mqueue in /var/spool for you.)

find has many other options (-xdev to restrict to current filesystem is good when you want to search / but not filesystems mounted on it like /opt or /home). Type "man find" for more details.

All times are GMT -5. The time now is 08:51 PM.