August 17, 2008

Finding files in directories

This posting is about 'find' unix command.

Linux has services command to handle processes that need to come up at start up time, and shutdown when system comes down. I use Sparc Solaris, v9, and (may be I don't know if there is) I have to (or I still) manage it manually. Sometimes I have to find what sym links are in /etc/rc*.d/ for certain app -- I usually get this part wrong too often -- if I want to look for :
[sourcecode language='css']
$ find /etc/rc*.d -name "*tomcat*" -print
[/sourcecode]
No quotes surrounding the directory pattern, no single/double quotes.

Here's an example:
[sourcecode language='css']
$ ls -ld rc*.d
drwxr-xr-x 2 root sys 1536 Aug 5 13:22 rc0.d
drwxr-xr-x 2 root sys 1024 Aug 5 13:22 rc1.d
drwxr-xr-x 2 root sys 2048 Aug 5 13:22 rc2.d
drwxr-xr-x 2 root sys 512 Aug 5 13:22 rc3.d
drwxr-xr-x 2 root sys 1536 Aug 5 13:22 rcS.d

$ find /etc/rc*.d -name "*tomcat*" -print
/etc/rc0.d/K15tomcat
/etc/rc1.d/K15tomcat
/etc/rc2.d/K15tomcat
/etc/rc3.d/S51tomcat
/etc/rcS.d/K15tomcat
[/sourcecode]

No comments:

Post a Comment