If your slocate/mlocate database is up to date, another method would be to use the "locate" utility.
Here's an example:
Code:
[user@host ~]$ touch mailer
[user@host ~]$ ls mailer
mailer
[root@host ~]# locate -i mailer | grep ^/home
[root@host ~]#
[root@host ~]# updatedb
[root@host ~]# locate -i mailer | grep ^/home
/home/user/mailer
A few things to note:
1. Running "updatedb" can take a while. The more files that exist on your machine, the longer it'll take
2. You may already have a cron job that updates the mlocate database already. This is the cron job:
Code:
[root@host ~]# ls -l /etc/cron.daily/mlocate.cron
-rw-r--r-- 1 root root 137 Sep 3 2009 /etc/cron.daily/mlocate.cron
This is the mlocate db that contains the list of files and directories on your machine:
Code:
[root@host ~]# ls -l /var/lib/mlocate/mlocate.db
-rw-r----- 1 root slocate 5602047 Mar 19 09:50 /var/lib/mlocate/mlocate.db
When "updatedb" is run, that's the file that gets updated. Again, you may already have a cron job in place which does this every day anyway.
You may also find the "locate" utility to be a bit quicker than running "find" when dealing with large amounts of data.