I am using the locate command on Linux. My current usage of it searches through the entire filesystem. I only want it to search within a specific directory. How can I do this?
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
|
|
Another approach would be to use the pattern matching in
Compare the output of the commands below:
|
|||||
|
|
The simplest answer I can think of is
The better solution might be to use "find" and its path options... |
|||
|
|
|
Create slocate database for your specific directory with:
and search with:
UPDATE This works fine on my Gentoo system but CentOS doesn't include Build the database with:
and search:
|
|||||||||
|