[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: using the 'find' program

hi ya

On Mon, 5 Sep 2005, Stephen R Laniel wrote:

> On Mon, Sep 05, 2005 at 09:12:41AM -0400, Kevin Coyner wrote:
> >     cd /tmp
> >     touch testfile
> >     find . -iname testfile -print
> > 
> > and I get nothing.

find --version
	GNU find version 4.2.24

ls -la > /tmp/ls.txt

find /tmp -name ls.txt -print
find /tmp -name ls.txt -ls
find /tmp -name ls.txt
	returns stuff ..

----- each of these has many other equivalent solutions ----

to find changes in the last 7 days

	find /etc -mtime -7 -ls

to find changes ONLY on Sep 1 ( 4 days ago )

	find /etc -mtime 4 -ls

to find anything that has "foo" in the name

	find /etc -name \*foo\* -sl

to find only symlinks

	find /etc -type l -ls

to find only directories

	find /etc -type d

to find only files and symlinks

	find /etc \( -type f -o -type l \) -ls

to remove "core" files .. but its dangerous, so check it first

	find /etc /root /usr -name /core$ -ls

	find /etc /root /usr -name /core$ -exec rm -f {} \;

	find /etc /root /usr -name /core$ -print | xargs rm -i

.. endless list of stuff ..

> On my end that works perfectly. You do, indeed, have the
> syntax right. Here's what I get:
> (09:16) slaniel@TheloniousMonk:~$ cd /tmp
> (09:16) slaniel@TheloniousMonk:/tmp$ touch testfile
> (09:16) slaniel@TheloniousMonk:/tmp$ find . -iname testfile
> ./testfile

c ya

Reply to: