Dec 5, 2012

Unix How to Find a Particular Directory


We know how to find a file in Unix directories using

This will search sample.txt in current directory

#]find . -iname sampe.txt


But if we want to find out a particular directory in the unix, type -d denotes search for directory

#] find / -name mysql -type d
/var/log/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/etc/mysql
/usr/lib/perl5/DBD/mysql
/usr/lib/perl5/auto/DBD/mysql
/usr/share/mysql


In order to narrow down the search, you could mention exact path (/etc) where you want to search

#] find /etc -name mysql -type d
/etc/mysql



No comments:

Post a Comment