ubuntu-users@lists.ubuntu.com
[Top] [All Lists]

Re: find a file

Subject: Re: find a file
From: "John Dangler"
Date: Mon, 6 Aug 2007 08:12:16 -0400

find -name "searchterm" /
Will search the entire drive for files...

As to the secondary question regarding grep, to find a specific word in a file (or files) in a directory, I usually do this little shell script, typed at the commandline-
for word in `ls`
do
cat $word | grep "searchword"
done

That will search each file in a directory and tell you which files have the word you want (if any)

I wouldn't recommend this for extremely large directories (or an entire disk).


----- Original Message -----
From: ubuntu-users-bounces@xxxxxxxxxxxxxxxx <ubuntu-users-bounces@xxxxxxxxxxxxxxxx>
To: Ubuntu user technical support,  not for general discussions <ubuntu-users@xxxxxxxxxxxxxxxx>
Sent: Mon Aug 06 07:21:46 2007
Subject: Re: find a file

On 8/6/07, norman <norman@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
<Prev in Thread] Current Thread [Next in Thread>