System wide find and sort

Hi,
I need to look for a config file (ldap.conf) and pick the latest modified file.

`locate` tells me there are many ldap.conf's, some in /etc, /usr, /home, etc.

Is there some way I can sort them by last modified time via bash?
I was thinking maybe I could pipe the output of `locate` to `ls -lt` but that doesn't seem to work.

Any ideas?

how about:

find / -type f -name 'ldap.conf' 2>/dev/null | xargs ls -lt

that works fine, thanks, but it has to manually search the entire file system, right?

is it possible to use the mlocate database via locate or some other tool?

I've not tested this, and it is rough, as I am not a shell expert, but would this help:

for i in `locate ldap.conf`
do
ll $i
done

then you have them by location and date stamp assuming noatime is not being used on the file system

oh actually, i did `updatedb` and i just combined the locate command with xargs and that worked:

$ sudo updatedb && locate ldap.conf | xargs ls -lt

thanks for the reply though :slight_smile: