-3

I would like to search for a file recursively under a directory. How do I search recursively for that file:

  1. in the directory I am standing in?
  2. in a specific directory?

The command should get a part of the file name and do the search, and return the full path of results, for example:

>> cd /
>> mysearch filename
/opt/dir/filename
/opt/dir2/filename23
/opt/dir3/filenamex
  • 2
    Surely any Linux sysadmin knows about find and locate ? – user9517 Jun 9 '12 at 21:42
  • 2
    This site is for professionals, who by definition know either how to do this simple stuff or how to find it - seriously, google 'find a file in linux' - you really thought it was easier to clog up this site, ignoring our FAQ and the whole point of the site, than do this google search? Please don't come back until you've learnt the basics and understand what this site it for. – Chopper3 Jun 9 '12 at 22:04
2

You need the find command

find . -name '*filename*'

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