How to find files without mounted shares?
Answer is this:
[root@agent2 /]# find / -fstype local -type d -iname collectd However it is annoying and it does go to /media which has mounted external hard drive. It not only shows "No such file or directory" errors but moreover its time consuming and not required when I know for sure collectd has to has files and folders on root file system. Anyway, I am looking for learned people to shed some more light. |
Does find / -fstype local ... really work?
I would rather go for find / -xdev ... And perhaps your system has "locate" or "mlocate" installed and working? Then it is just Code:
locate collectd |
Actually locate work but it doesn't help me.For reason I want to find collectd.cgi script. I can go to my tutorial and find its location but that doesn't make me independent researcher.
xdev gives this syntax error. [root@agent2 /]# find / -xdev local -type d -iname collectd find: paths must precede expression: local Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] [root@agent2 /]# |
Output of locate
[root@agent2 /]# locate collectd /etc/selinux/targeted/modules/active/modules/collectd.pp /opt/puppetlabs/puppet/share/augeas/lenses/dist/collectd.aug /opt/puppetlabs/puppet/share/augeas/lenses/dist/tests/test_collectd.aug /usr/share/augeas/lenses/dist/collectd.aug /usr/share/selinux/devel/include/services/collectd.if /usr/share/selinux/targeted/collectd.pp.bz2 [root@agent2 /]# |
You must replace
Code:
-fstype local Code:
-xdev |
Thanks MadeInGermany ! You got it right.
I want to take it further, with directories found for each directory I want to find file with extension "*.cgi" [root@agent2 /]# find / -xdev -type d -iname collectd /var/lib/collectd /usr/lib64/collectd /usr/include/collectd /usr/share/collectd [root@agent2 /]# find / -xdev -type d -iname collectd|xargs find -type f -iname "*.cgi" find: paths must precede expression: /var/lib/collectd Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] [root@agent2 /]# This would be good as we can use practically for anything and everything. |
find needs the start directories first, while xargs by default puts them last. You can use -i or -I option for xargs
Code:
find / -xdev -type d -iname collectd | xargs -i find {} -type f -iname "*.cgi" Code:
find / -xdev -type d -iname collectd -exec ls {} \; | grep '.*\.cgi$' |
Many Thanks mate ! It does help. I am raising another thread for not having examples directory after collectd installation
|
All times are GMT -5. The time now is 10:40 AM. |