Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix locate command for present working directory

Tags:

command

unix

The locate command in Unix will return the path related to the attribute given (for example, locate abc_file). What is the command to locate a file in the present working directory structure?

like image 400
sheik Avatar asked Dec 04 '22 21:12

sheik


1 Answers

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).

like image 149
bmk Avatar answered Feb 13 '23 21:02

bmk