finding a file in Unix

Hi Guys

I'm trying to look for a file in Unix but I do not know which path or directory it may be located in. Does anyone know the command to search and display the directory of a certain file? Thanks!

see the 'man' page for find.

find . -name 'filename'

or if you have the root and wanna search in the whole system

find / -name "pattern"

The man page will explain the difference between "find ." and "find /"

Basically the "." says `From here` or your current working directory. The "/" indicates that you wish to start searching from the root directory (top of the directory tree).

Hope that helps.

If you don't want all that junk that goes along with a find output from /, then use the 2> /dev/null.

This will send all erroneous messages that would normally come from stderr to stdout and send them to /dev/null so your screen will only show you the result you are seeking or nothing if the search had no result.

find / -name myfile 2> /dev/null

My brain is your brain....

:smiley:

Gotta leave some work for handynas......!

thanks guys, you've been most helpful, I can now find my file....