find a file

Matt Morgan minxmertzmomo at gmail.com
Mon Aug 13 15:23:35 UTC 2007


On 8/6/07, Allan Valeriano <allvaleriano at gmail.com> wrote:
> On 8/6/07, norman <norman at littletank.org> wrote:
> > Although I have used Ubuntu for quite some time I have never been sure
> > how to go about finding named files. I am not a Linux person although, I
> > can use a terminal if needed. For example I needed to find any files
> > with .lck as the extension and remove them otherwise I would be unable
> > to burn DVDs using Mthtv. So, I went to Places -> Search for files,
> > entered *.lck and the report was no files found. Yet there had to be at
> > least one file which was causing me the problem.
>
> That's one problem I have too. Sometimes I find things using the "locate -R"
> command, but sometimes it doesn't work. I still haven't learned how to
> search things on linux.
>  I have also looked on man and google about how to use the grep command, but
> still haven't figured out how to find things this way. A couple of days ago,
> I wanted to find all the files containing a specific word, but couldn't
> figure out how to use the grep command. =(
>
>  Allan
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
>

This thread gave up on 'locate' (in favor of 'find') too soon. Find is
awesome--knowing find well is a great strength. But for just looking
for files, locate can be easier & a lot faster.

The trick is usually that the slocate database (what locate uses for
the index it searches) needs to be kept updated. Most linuxes updated
the db daily in cron/anacron; I'm new to Ubuntu & don't know what it
does. To update the database manually, run

sudo updatedb

and then any 'locate' command that follows will

a) work
b) run lots faster than most 'find' commands

(but you can't do tricks with the files you find, like you can with 'find').

--Matt




More information about the ubuntu-users mailing list