Q. How can I locate files without using 'find' ?

Posted by : Anonymous | 17 November, 2005 | Published in

Good question. Using the Solaris find utility is a great way to find a file - it is however quite resource intensive in that it checks through your filesystem.

A quicker, and less resource intensive, way to locate system files is to grep the filename is /var/sadm/install/contents. The /var/sadm/install/contents file contains a list of all files that are installed on the system by way of pkgadd. So it's a good start but not necessarily everything.

What you can do is use cron to create an entire system index each night and then grep that index when you're looking for a file. So, your cron entry could be as simple as

00 01 * * * /usr/bin/find / -print > /var/SystemIndex.contents 2>/dev/null

When you want to locate a file, grep the file name (using regexp). So, if you wanted to find files that called hosts then you would use:-

# grep -i hosts /var/SystemIndex.contents

(0) Comments

Copyright 2005-2010, ask|dr.root, brought to you by Avnet Technology Solutions