How to find a file based on name easily from thousands files
Most of my data is on the NFS side. There are more than hundreds of thousand files in each directory. how can find a file based on name easily?I don't what happened when I run find ./ -name "**" but it is very slow to show the result. Anybody has any idea about this ? can you tell me what happen when I run the find command? like the inode, directory, etc
Linux
Last Comment
Tintin
8/22/2022 - Mon
Patrick Bogers
Hi
I would use:
ls /directory | grep <name you are looking for>
karanprabham
For Speed use locate command
jeff_01
locate is fast but only if the index is kept up to date. It searches through a prebuilt database which is updated using the command updatedb .
If you don't know what directory or sub-set of directories the file might exist in and you don't have an index of the files (via locate or any other similar command), then you are essentially stuck with the speed of traversing NFS.
Note that
find ./ -name "**"
is effectively the same as
find ./
ie: it will match everything.
Make sure you include part of the filename in the match, eg:
I would use:
ls /directory | grep <name you are looking for>