[ubuntu-uk] find a file

Jeronimo Garcia garciaj at gmail.com
Mon Aug 6 12:22:40 BST 2007


-prune will work too.
Cheers m888888

On 8/6/07, Matthew Wild <mwild1 at gmail.com> wrote:
>
> I do wish find didn't do that :)
>
> You can strip the error output by appending 2>/dev/null to the end of the
> command. I don't know if there is another way... I never found it.
>
> On 8/6/07, Josh Blacker <jkblacker at gmail.com> wrote:
> >
> > You can use:
> >
> > find / -name *.lck
> >
> > but this will probably throw up a lot of useless stuff. I searched
> > 'find / -name *.sla' and got:
> >
> > find: /lost+found: Permission denied
> > find: /etc/ssl/private: Permission denied
> > find: /etc/cups/ssl: Permission denied
> > find: /var/lib/slocate: Permission denied
> > find: /var/lib/gdm: Permission denied
> > find: /var/cache/system-tools-backends/backup: Permission denied
> > find: /var/run/wpa_supplicant: Permission denied
> > find: /var/run/cups/certs: Permission denied
> > find: /var/spool/cron/atspool: Permission denied
> > find: /var/spool/cron/crontabs: Permission denied
> > find: /var/spool/cron/atjobs: Permission denied
> > find: /var/spool/cups: Permission denied
> > find: /proc/bus/usb/.usbfs/005: Permission denied
> > find: /proc/bus/usb/.usbfs/004: Permission denied
> > find: /proc/bus/usb/.usbfs/003: Permission denied
> > find: /proc/bus/usb/.usbfs/002: Permission denied
> > find: /proc/bus/usb/.usbfs/001: Permission denied
> > find: /proc/tty/driver: Permission denied
> > find: /proc/1/task/1/fd: Permission denied
> > find: /proc/1/fd: Permission denied
> > find: /proc/2/task/2/fd: Permission denied
> > find: /proc/2/fd: Permission denied
> > find: /proc/3/task/3/fd: Permission denied
> > find: /proc/3/fd: Permission denied
> > find: /proc/4/task/4/fd: Permission denied
> > find: /proc/4/fd: Permission denied
> > find: /proc/5/task/5/fd: Permission denied
> > find: /proc/5/fd: Permission denied
> > find: /proc/6/task/6/fd: Permission denied
> > find: /proc/6/fd: Permission denied
> > find: /proc/7/task/7/fd: Permission denied
> > find: /proc/7/fd: Permission denied
> > find: /proc/30/task/30/fd: Permission denied
> > find: /proc/30/fd: Permission denied
> > find: /proc/31/task/31/fd: Permission denied
> > find: /proc/31/fd: Permission denied
> > find: /proc/32/task/32/fd: Permission denied
> > find: /proc/32/fd: Permission denied
> > find: /proc/145/task/145/fd: Permission denied
> > find: /proc/145/fd: Permission denied
> > find: /proc/166/task/166/fd: Permission denied
> > find: /proc/166/fd: Permission denied
> > find: /proc/167/task/167/fd: Permission denied
> > find: /proc/167/fd: Permission denied
> > find: /proc/168/task/168/fd: Permission denied
> > find: /proc/168/fd: Permission denied
> > find: /proc/169/task/169/fd: Permission denied
> > find: /proc/169/fd: Permission denied
> > find: /proc/1965/task/1965/fd: Permission denied
> > find: /proc/1965/fd: Permission denied
> > find: /proc/1966/task/1966/fd: Permission denied
> > find: /proc/1966/fd: Permission denied
> > find: /proc/2001/task/2001/fd: Permission denied
> > find: /proc/2001/fd: Permission denied
> > find: /proc/2018/task/2018/fd: Permission denied
> > find: /proc/2018/fd: Permission denied
> > find: /proc/2019/task/2019/fd: Permission denied
> > find: /proc/2019/fd: Permission denied
> > find: /proc/2133/task/2133/fd: Permission denied
> > find: /proc/2133/fd: Permission denied
> > find: /proc/2150/task/2150/fd: Permission denied
> > find: /proc/2150/fd: Permission denied
> > find: /proc/2151/task/2151/fd: Permission denied
> > find: /proc/2151/fd: Permission denied
> > find: /proc/2329/task/2329/fd: Permission denied
> > find: /proc/2329/fd: Permission denied
> > find: /proc/2528/task/2528/fd: Permission denied
> > find: /proc/2528/fd: Permission denied
> > find: /proc/3355/task/3355/fd: Permission denied
> > find: /proc/3355/fd: Permission denied
> > find: /proc/3473/task/3473/fd: Permission denied
> > find: /proc/3473/fd: Permission denied
> > find: /proc/3575/task/3575/fd: Permission denied
> > find: /proc/3575/fd: Permission denied
> > find: /proc/3576/task/3576/fd: Permission denied
> > find: /proc/3576/fd: Permission denied
> > find: /proc/3878/task/3878/fd: Permission denied
> > find: /proc/3878/fd: Permission denied
> > find: /proc/3883/task/3883/fd: Permission denied
> > find: /proc/3883/fd: Permission denied
> > find: /proc/4152/task/4152/fd: Permission denied
> > find: /proc/4152/fd: Permission denied
> > find: /proc/4153/task/4153/fd: Permission denied
> > find: /proc/4153/fd: Permission denied
> > find: /proc/4157/task/4157/fd: Permission denied
> > find: /proc/4157/fd: Permission denied
> > find: /proc/4158/task/4158/fd: Permission denied
> > find: /proc/4158/fd: Permission denied
> > find: /proc/4159/task/4159/fd: Permission denied
> > find: /proc/4159/fd: Permission denied
> > find: /proc/4160/task/4160/fd: Permission denied
> > find: /proc/4160/fd: Permission denied
> > find: /proc/4428/task/4428/fd: Permission denied
> > find: /proc/4428/fd: Permission denied
> > find: /proc/4522/task/4522/fd: Permission denied
> > find: /proc/4522/fd: Permission denied
> > find: /proc/4575/task/4575/fd: Permission denied
> > find: /proc/4575/fd: Permission denied
> > find: /proc/4577/task/4577/fd: Permission denied
> > find: /proc/4577/fd: Permission denied
> > find: /proc/4598/task/4598/fd: Permission denied
> > find: /proc/4598/fd: Permission denied
> > find: /proc/4614/task/4614/fd: Permission denied
> > find: /proc/4614/fd: Permission denied
> > find: /proc/4615/task/4615/fd: Permission denied
> > find: /proc/4615/fd: Permission denied
> > find: /proc/4621/task/4621/fd: Permission denied
> > find: /proc/4621/fd: Permission denied
> > find: /proc/4622/task/4622/fd: Permission denied
> > find: /proc/4622/fd: Permission denied
> > find: /proc/4629/task/4629/fd: Permission denied
> > find: /proc/4629/fd: Permission denied
> > find: /proc/4648/task/4648/fd: Permission denied
> > find: /proc/4648/fd: Permission denied
> > find: /proc/4651/task/4651/fd: Permission denied
> > find: /proc/4651/fd: Permission denied
> > find: /proc/4663/task/4663/fd: Permission denied
> > find: /proc/4663/fd: Permission denied
> > find: /proc/4676/task/4676/fd: Permission denied
> > find: /proc/4676/fd: Permission denied
> > find: /proc/4691/task/4691/fd: Permission denied
> > find: /proc/4691/task/4704/fd: Permission denied
> > find: /proc/4691/task/4738/fd: Permission denied
> > find: /proc/4691/task/5594/fd: Permission denied
> > find: /proc/4691/fd: Permission denied
> > find: /proc/4709/task/4709/fd: Permission denied
> > find: /proc/4709/fd: Permission denied
> > find: /proc/4710/task/4710/fd: Permission denied
> > find: /proc/4710/fd: Permission denied
> > find: /proc/4723/task/4723/fd: Permission denied
> > find: /proc/4723/fd: Permission denied
> > find: /proc/4739/task/4739/fd: Permission denied
> > find: /proc/4739/fd: Permission denied
> > find: /proc/4740/task/4740/fd: Permission denied
> > find: /proc/4740/fd: Permission denied
> > find: /proc/4789/task/4789/fd: Permission denied
> > find: /proc/4789/fd: Permission denied
> > find: /proc/4790/task/4790/fd: Permission denied
> > find: /proc/4790/fd: Permission denied
> > find: /proc/4795/task/4795/fd: Permission denied
> > find: /proc/4795/fd: Permission denied
> > find: /proc/4854/task/4854/fd: Permission denied
> > find: /proc/4854/fd: Permission denied
> > find: /proc/4878/task/4878/fd: Permission denied
> > find: /proc/4878/fd: Permission denied
> > find: /proc/4883/task/4883/fd: Permission denied
> > find: /proc/4883/fd: Permission denied
> > find: /proc/4968/task/4968/fd: Permission denied
> > find: /proc/4968/fd: Permission denied
> > find: /proc/5014/task/5014/fd: Permission denied
> > find: /proc/5014/fd: Permission denied
> > find: /proc/5054/task/5054/fd: Permission denied
> > find: /proc/5054/fd: Permission denied
> > find: /proc/5072/task/5072/fd: Permission denied
> > find: /proc/5072/fd: Permission denied
> > find: /proc/5106/task/5106/fd: Permission denied
> > find: /proc/5106/fd: Permission denied
> > find: /proc/5120/task/5120/fd: Permission denied
> > find: /proc/5120/fd: Permission denied
> > find: /proc/5300/task/5300/fd: Permission denied
> > find: /proc/5300/fd: Permission denied
> > find: /proc/5593/task/5593/fd: Permission denied
> > find: /proc/5593/fd: Permission denied
> > find: /proc/5615/task/5615/fd: Permission denied
> > find: /proc/5615/fd: Permission denied
> > find: /proc/5704/task/5704/fd: Permission denied
> > find: /proc/5704/fd: Permission denied
> > find: /proc/5705/task/5705/fd: Permission denied
> > find: /proc/5705/fd: Permission denied
> > find: /proc/5722/task/5722/fd: Permission denied
> > find: /proc/5722/fd: Permission denied
> > find: /proc/7326/task/7326/fd: Permission denied
> > find: /proc/7326/fd: Permission denied
> > find: /proc/10034/task/10034/fd: Permission denied
> > find: /proc/10034/fd: Permission denied
> > find: /sys/fs/fuse/connections/1: Permission denied
> > find: /dev/bus/usb/.usbfs/005: Permission denied
> > find: /dev/bus/usb/.usbfs/004: Permission denied
> > find: /dev/bus/usb/.usbfs/003: Permission denied
> > find: /dev/bus/usb/.usbfs/002: Permission denied
> > find: /dev/bus/usb/.usbfs/001: Permission denied
> > find: /home/guest/.gnome2: Permission denied
> > find: /home/guest/.Trash: Permission denied
> > find: /home/guest/.mozilla: Permission denied
> > find: /home/guest/.gconfd: Permission denied
> > find: /home/guest/.openoffice.org2: Permission denied
> > find: /home/guest/.metacity: Permission denied
> > find: /home/guest/.gnome2_private: Permission denied
> > find: /home/guest/.nautilus/metafiles: Permission denied
> > find: /home/guest/.thumbnails: Permission denied
> > find: /home/guest/.gaim: Permission denied
> > find: /home/guest/.config: Permission denied
> > find: /home/guest/.gconf: Permission denied
> > find: /home/lost+found: Permission denied
> > /home/josh/pi_poster.sla
> >
> > The final result is the one I would have been looking for (and even
> > then, it misses a couple of files in a subdirectory of my home
> > folder).
> >
> > On 8/6/07, norman < norman at littletank.org> wrote:
> > > < snip >
> > > >
> > > > Josh Blacker wrote:
> > > > > There are the two commands 'find' and 'locate' from the command
> > line.
> > > > > One is slower because it literally trawls the system to find
> > things,
> > > > > and the other works from a database that's updated every so often
> > - so
> > > > > it can miss newer files. (I think find is the faster one, but I
> > could
> > > > > be wrong) As far as I know, find has many more options than locate
> > (eg
> > > > > to search from the parent directory to a specified depth) - I
> > remember
> > > > > reading about it somewhere.
> > > >
> > > > find /your/path/to/a/directory -name '*.lck' -print
> > > >
> > > > Find trawls the files system but appears to cache when re-run with a
> > > > short (hours) time.  I've ever used locate.  It has a db where it
> > > > 'locates' files.  BTY, if you are using find on directories that you
> >
> > > > don't "own", you may need to sudo find has the errors it produces
> > when
> > > > it doesn't have permission to read a directory can overwhelm the
> > actual
> > > > output of any search.
> > >
> > > Thanks to all who have had a go at answering my question. However, am
> > I
> > > to understand that I need to know where I might find the file I am
> > > seeking before I go looking? If that is the case then it defeats what
> > I
> > > thought was the idea. What I was looking for was a
> > > command which would tell the computer to search every folder on my
> > > system.
> > >
> > > Norman
> > >
> > >
> > > --
> > > ubuntu-uk at lists.ubuntu.com
> > > https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
> > > https://wiki.kubuntu.org/UKTeam/
> > >
> >
> >
> > --
> > Josh Blacker
> > http://jerichokb.wordpress.com/
> >
> > --
> > ubuntu-uk at lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
> > https://wiki.kubuntu.org/UKTeam/
> >
>
>
> --
> ubuntu-uk at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
> https://wiki.kubuntu.org/UKTeam/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20070806/bfeedc78/attachment.htm 


More information about the ubuntu-uk mailing list