Unix locate command for present working directory
The locate command in Unix will return the path related to the attribute given (for example, locate abc_file
). Wh开发者_高级运维at is the command to locate a file in the present working directory structure?
If you use wildcards (as *
) locate
considers the pattern to be an absolute path. Therefore you could e.g. do:
locate "$PWD*/abc_file"
This will find all files abc_file
under your $PWD
and its subfolders (as long as they are in the locate database).
On the other hand you can also always use oldschool find:
find . -name abc_file
精彩评论