LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-03-2016, 10:10 AM   #1
sysmicuser
Member
 
Registered: Mar 2010
Posts: 334

Rep: Reputation: 0
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.
 
Old 06-03-2016, 10:24 AM   #2
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 255

Rep: Reputation: 101Reputation: 101
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

Last edited by MadeInGermany; 06-03-2016 at 10:26 AM.
 
Old 06-03-2016, 10:43 AM   #3
sysmicuser
Member
 
Registered: Mar 2010
Posts: 334

Original Poster
Rep: Reputation: 0
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 /]#
 
Old 06-03-2016, 10:45 AM   #4
sysmicuser
Member
 
Registered: Mar 2010
Posts: 334

Original Poster
Rep: Reputation: 0
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 /]#
 
Old 06-03-2016, 10:46 AM   #5
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 255

Rep: Reputation: 101Reputation: 101
You must replace
Code:
-fstype local
by
Code:
-xdev
 
1 members found this post helpful.
Old 06-03-2016, 11:06 AM   #6
sysmicuser
Member
 
Registered: Mar 2010
Posts: 334

Original Poster
Rep: Reputation: 0
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.
 
Old 06-03-2016, 11:50 AM   #7
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 255

Rep: Reputation: 101Reputation: 101
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"
but an ls on the directories is simpler
Code:
find / -xdev -type d -iname collectd -exec ls {} \; | grep '.*\.cgi$'
 
1 members found this post helpful.
Old 06-03-2016, 11:58 AM   #8
sysmicuser
Member
 
Registered: Mar 2010
Posts: 334

Original Poster
Rep: Reputation: 0
Many Thanks mate ! It does help. I am raising another thread for not having examples directory after collectd installation
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofs problem - shares are not mounted igor012 Linux - Networking 1 03-21-2012 10:34 AM
problems with mounted samba shares v1pEr Linux - Software 4 06-15-2007 01:27 PM
mounted shares are read only xubuntu_idiot Linux - Networking 6 09-05-2006 05:38 AM
mounted samba shares disappear jsmarshall85 SUSE / openSUSE 4 02-02-2005 03:49 PM
Problems with mounted Samba shares Fozza Linux - Software 1 12-09-2004 05:00 PM


All times are GMT -5. The time now is 08:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration