Find file in directory from command line

whoisbenli picture whoisbenli · Mar 18, 2009 · Viewed 106.5k times · Source

In editors/ides such as eclipse and textmate, there are shortcuts to quickly find a particular file in a project directory.

Is there a similar tool to do full path completion on filenames within a directory (recursively), in bash or other shell?

I have projects with alot of directories, and deep ones at that (sigh, java). Hitting tab in the shell only cycles thru files in the immediate directory, thats not enough =/

Answer

strager picture strager · Mar 18, 2009
find /root/directory/to/search -name 'filename.*'
# Directory is optional (defaults to cwd)

Standard UNIX globbing is supported. See man find for more information.

If you're using Vim, you can use:

:e **/filename.cpp

Or :tabn or any Vim command which accepts a filename.