Author Topic: "find" and me struggle again  (Read 844 times)

Online wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2438
  • Any Bugs in site?
"find" and me struggle again
« on: September 05, 2010, 08:23:47 PM »
I am trying to come to grips with find to find files,

I was trying to find out where 'cups' executable is located so I tried

Code: [Select]
[root@localhost /]# which cups
which: no cups in (/sbin:/usr   .........

Since cups is running I expect there will be a executable

Code: [Select]
[root@localhost /]# find -name cups
./etc/portreserve/cups
./etc/logrotate.d/cups
./etc/cups
./etc/rc.d/init.d/cups
./etc/sysconfig/cups
./etc/pam.d/cups
./usr/lib/cups
./usr/share/cups
./var/spool/cups
./var/run/cups
./var/lock/subsys/cups
./var/log/cups
./var/cache/cups
[root@localhost /]# which cups

Hmmm, but which one

Code: [Select]
[root@localhost /]# find / -executable cups
find: paths must precede expression: cups
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

and a few other permutations, I am getting something wrong.

Any pointers appreciated?
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

genomega

  • Guest
Re: "find" and me struggle again
« Reply #1 on: September 05, 2010, 10:12:01 PM »
You can use locate to find executable's, but cups is a different animal, it's a server.
Using pcc system services is the easiest way to deal with cups.

uncleV

  • Guest
Re: "find" and me struggle again
« Reply #2 on: September 06, 2010, 07:14:11 AM »
Quote
"find" and me struggle again
Who wins? ;)

catfish is a simple and light GUI for find and locate.
Having catfish installed I'd use find only for more special searches or a script work.
« Last Edit: September 06, 2010, 07:19:50 AM by uncleV »

Offline s2cuts

  • Jr. Member
  • **
  • Posts: 29
Re: "find" and me struggle again
« Reply #3 on: September 06, 2010, 07:22:52 AM »
Yeah, cups is a daemon.  You're wanting to look for "cupsd" I think.

Code: [Select]
# find / -mount -name cupsd

Online wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2438
  • Any Bugs in site?
Re: "find" and me struggle again
« Reply #4 on: September 06, 2010, 07:39:07 AM »
uncleV
So far I have had a very poor round, find is ahead by many points  ;D

Interesting about catfish did not know that one [actually there is a lot I don't know]
I am trying to learn as much as I can of non GUI, I seem to run into trouble too often where the GUI is not there.

s2cuts
Thanks, why could I not remember that it would be a daemon, but I did realise my brain was baulking so I decided it was time for the cavalry   :D

Code: [Select]
[root@localhost gert]# find / -mount -name cupsd
/usr/sbin/cupsd

Of curiosity what does the -mount do?  I get same result with or without?
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

uncleV

  • Guest
Re: "find" and me struggle again
« Reply #5 on: September 06, 2010, 07:41:39 AM »
I am trying to learn as much as I can of non GUI, I seem to run into trouble too often where the GUI is not there.

Me too but reading man pages or info on find my mind feels... mhh... too acrobatic.

Offline s2cuts

  • Jr. Member
  • **
  • Posts: 29
Re: "find" and me struggle again
« Reply #6 on: September 06, 2010, 07:53:23 AM »

Of curiosity what does the -mount do?  I get same result with or without?


-mount tells find not to recurse down mounted shares, partitions, anything that's been mounted underneath where you're searching from.  I usually have large data shares mounted to my system, so avoiding them when using find means avoiding painfully long search times.

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6380
  • I'm going South
Re: "find" and me struggle again
« Reply #7 on: September 06, 2010, 08:28:58 AM »
If you know the name of the executable which will find it for you even in this case where it is a daemon. So
Code: [Select]
which cupsdwill work -- and it could be much faster than using find (even if you use find with the -mount option).

Myself, I usually use the pedestrian locate. Then I don't have to know whether I'm looking for cupsd or just cups.

Of course
Code: [Select]
locate cupswill give you too many hits to be useful.

But if you are looking for an executable, the odds are that it is in /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/X11R6/bin or ~/bin -- in other words, in a directory whose name ends with "bin". So before anything else I'd try
Code: [Select]
locate bin/cups
Try it: locate will list a few cups related programs but not too many. (And in addition to cupsd some of others could actually be of interest to you. But if you're really looking for a library you won't find it this way.)
« Last Edit: September 06, 2010, 08:56:08 AM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Online wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2438
  • Any Bugs in site?
Re: "find" and me struggle again
« Reply #8 on: September 06, 2010, 09:11:05 AM »
blackbird
Well I certainly is a fan of locate, in this case it partly failed because 'locate cups' has more than 1000 entries and rolls off the konsole buffer and anything 'bin' is long gone, actually in my case I am down to 'usr....' on the first line so I never got the 'bin' association, this might have triggered my brain.

The clue was cupsd, which I ought to have remembered, I know it, though I was getting a bit agitated over not getting anywhere.

Just for the fun, here is the suggested result, and you are right there is a couple of interest to me here.  I guess you know where 'cupsd' is, but it would have been nice if it had shown up here too.  

Code: [Select]
[root@localhost /]# locate /bin/cups
/usr/bin/cups-calibrate
/usr/bin/cups-drivers-splix-decompress
/usr/bin/cupstestdsc
/usr/bin/cupstestppd
[root@localhost /]#

I am back on track.

Thanks for post, I will remember the 'bin' next time, hopefully. Everytime I think I am doing really well now, I get one of those items to keep me in line.  ;D
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

uncleV

  • Guest
Re: "find" and me struggle again
« Reply #9 on: September 06, 2010, 09:45:58 AM »
You can use a pipe with filter (grep) for a huge output:
locate cups | grep bin

Here you search "cups" with locate and get the lines containing "bin" filtered by grep.
The pipe (or conveyor) itself is the "|" sign.
« Last Edit: September 06, 2010, 09:50:02 AM by uncleV »

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6380
  • I'm going South
Re: "find" and me struggle again
« Reply #10 on: September 06, 2010, 10:08:48 AM »
blackbird
Well I certainly is a fan of locate, in this case it partly failed because 'locate cups' has more than 1000 entries and rolls off the konsole buffer and anything 'bin' is long gone, actually in my case I am down to 'usr....' on the first line so I never got the 'bin' association, this might have triggered my brain.

The clue was cupsd, which I ought to have remembered, I know it, though I was getting a bit agitated over not getting anywhere.

Just for the fun, here is the suggested result, and you are right there is a couple of interest to me here.  I guess you know where 'cupsd' is, but it would have been nice if it had shown up here too.  

Code: [Select]
[root@localhost /]# locate /bin/cups
/usr/bin/cups-calibrate
/usr/bin/cups-drivers-splix-decompress
/usr/bin/cupstestdsc
/usr/bin/cupstestppd
[root@localhost /]#

I am back on track.

Thanks for post, I will remember the 'bin' next time, hopefully. Everytime I think I am doing really well now, I get one of those items to keep me in line.  ;D

But try "locate bin/cups" instead of "locate /bin/cups". It would have given you a few more hits, but among them "/usr/sbin/cupsd" -- which presumably is what you were looking for.

(uncleV's suggestion is of course excellent.)
« Last Edit: September 06, 2010, 10:11:20 AM by blackbird »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Online wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2438
  • Any Bugs in site?
Re: "find" and me struggle again
« Reply #11 on: September 06, 2010, 10:22:29 AM »
blackbird
I missed that one too,  ;D, my sixth sense was banging away on my head while I looked at the little note about "in addition cupsd", but I said go away I know better. .  My sixth sense is saying "There I tried to tell you, stubborn ass".

uncleV
Yes I did think of grepping too but thought that even that might run off the screen. I could have piped it to a text file and opened with Kwrite and used the search facility here. At least I would have the lot. I had just been doing too much of that already today

Thank you both.
« Last Edit: September 06, 2010, 10:25:30 AM by wedgeling »
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Online wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2438
  • Any Bugs in site?
Re: "find" and me struggle again
« Reply #12 on: September 10, 2010, 09:45:17 AM »
I thought I was on track  :'(  :'(
Tell me, am I going around the bend? For quite some while I have been trying to locate cupsd but I don't get any hits, despite I know cupsd is there, see it bit further down in the konsole prints.  What am I doing wrong.  This is going to be a very very long night. (Was looking for the cupsd.conf file).
  

Code: [Select]
[root@localhost gert]# locate cupsd
/usr/lib/libcupsdriver.so.1

[root@localhost gert]# cd /etc/cups
[root@localhost cups]# ls
cupsd.conf   cupsd.conf.default  interfaces/        ppd/           printers.conf.O   snmp.conf
cupsd.conf~  cupsd.conf.O        pdftoraster.convs  printers.conf  pstoraster.convs  ssl/
[root@localhost cups]# which cupsd
/usr/sbin/cupsd
[root@localhost cups]#
« Last Edit: September 10, 2010, 09:47:01 AM by wedgeling »
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6380
  • I'm going South
Re: "find" and me struggle again
« Reply #13 on: September 10, 2010, 10:03:21 AM »
Strange. I get this:
Quote
[root@localhost erik]# locate cupsd
/etc/cups/cupsd.conf
/etc/cups/cupsd.conf.default
/usr/lib/libcupsdriver.a
/usr/lib/libcupsdriver.so
/usr/lib/libcupsdriver.so.1
/usr/sbin/cupsd
/usr/sbin/cupsdisable
/usr/share/cups/doc/help/man-cupsd.html
/usr/share/cups/doc/help/ref-cupsd-conf.html
/usr/share/locale/sv/LC_MESSAGES/cupsdconf.mo
/usr/share/man/man5/cupsd.conf.5.bz2
/usr/share/man/man8/cupsd.8.bz2
/usr/share/man/man8/cupsdisable.8.bz2
/var/run/cupsd.pid

And precisely the same thing if I run the command as my normal user.

Is your locate database up-to-date. It could be that cron hasn't run the script that updates it automatically,  particularly if you habitually shut down your computer when you go to bed. Normally the script (/etc/cron.daily/mlocate.cron) will be run a little after four in the morning. So try running updatedb manually as root.

And if that doesn't help, post the contents of /etc/updatedb.conf. (That's were you specify which folders and filesystem to skip when the database is rebuilt.)
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Online wedgetail

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 2438
  • Any Bugs in site?
Re: "find" and me struggle again
« Reply #14 on: September 10, 2010, 10:28:21 AM »
blackbird
thanks, you confirmed what I was expecting to see. Pheeeew, I was getting real worried. I have 3 test systems 2 pclos2010.7 fully updated but customised light and second one more heavily with fx OpenOffice but for a bit fast work I have pclos2010-LXDE-KDE451 and I was working in that trying to track down some funny denied access to CUPS server that should not happen, another member has reported that.

The description I should be able to simulate very simply, but this is in the management area where very few indeed would go and mess, But I find I cannot make the setting work.  That is however a sidetrack. I have moved back onto one of the bigger systems and my blood-pressure is decreasing again.  I find I get the same result here doing locate cupsd as you did.

I thought the udatedb had been run yesterday or day before when I started looking at the problem.  To be asbolutely sure I will go back to LXDE   :-[
32 bit: KDE (older) & various KDE-mini, ASUSTek P5P41D Rev X.0x, BIOS AMI0207 07/21/2009, "Pentium(R) Dual-Core CPU E5300 @ 2.60GHz", nVidia GeForce 9600 GT, 2x1GB Seagate Technology 1000528AS HDD
TV CompuPro VideoMate Vista E700 (not working in Linux), Acer X243HD LCD Screen