Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using linux server and a file is missing and I need to find all the files matching a name MyMissingFile can I issue a command that will do a recrusive search of all the directories under user folder and tell me where the file is
I am not a root user. Thanks

share|improve this question
up vote 3 down vote accepted

How about

 cd <userfolder>
 find . -name <filename> -print

BTW, filename could be contain a pattern, and


 find . -name '*MyMissingFile*' -print
share|improve this answer
-print is unnecessary (it's the default) – tylerl Aug 26 '10 at 21:31
cd is unnecessary: find /path/to/dir -name filename – Dennis Williamson Aug 27 '10 at 1:09
worth mentioning -iname when used the search is NOT case sensitive – Radek Aug 27 '10 at 7:01

There are several ways to find a file.

The easiest one is probably to use the locate command. This command uses a cache of known files. In order to use it, you need to make sure the cache is up-to-date, using updatedb. In your case, you will have to trust that it is up-to-date since you are not root and cannot update the db. To use locate, type:

$ locate MyMissingFile

If you want only files called exactly "MyMissingFile", use:

$ locate MyMissingFile | grep "/MyMissingFile$"

Now if you know in which directory your file is, you can use find. find does not rely on a cache db, and will scan recursively the directory and print all the files it finds. There are tons of options to filter the found files (see man find to list them), including a -name option to filter on the file name. Use it as such:

$ find $yourdirectory -name MyMissingFile

which will match files whose names are exactly "MyMissingFile". To match names that contain "MyMissingFile", use:

$ find $yourdirectory -name "*MyMissingFile*"

Note that locate is usually much faster than find, since it has the answers in cache, while find needs to read all the files under the given directory.

share|improve this answer
locate -r '/MyMissingFile$'

is more efficient than the suggestions using grep. But not every version of locate accepts -r (though the locate in GNU findutils does).

share|improve this answer

Your Answer


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.