On Sun, 28 Apr 2002, Samuel W. Heywood wrote:

> Format:     FINDIT  [drive:]filename[.[ext]] [/Q]
> 
> Does anyone here know where I can get a somewhat equivalent program
> for Linux?

  In full distributions, you can use 'locate'.

$ locate *54.JPG
/home/steve/pics/DCP00354.JPG
/home/steve/pics/DCP00454.JPG
/home/steve/.arachne/cache/1018834254.JPG
/home/steve/.arachne/cache/1019354854.JPG
/home/httpd/html/apache_rez/0004/DCP00154.JPG
/home/httpd/html/apache_rez/0003/DCP00054.JPG
/home/stackman/DCP00354.JPG

  This is *FAST* because it checks a database of all the 
files on your machine.  Normally the database is updated 
once a day with a cron job calling 'updatedb'.  Again, this 
pertains to full distributions.

  If you're using BasicLinux, I kinda doubt you have that, 
but you probably still have 'find' which actually searches 
through the whole drive for the info requested.  

  In order to do the same thing using 'find' you'd use this 
syntax:

$ find <starting directory> -name <filename or pattern>

example:

$ find /home -name *54.JPG

  It's very time consuming on multi-GB drives... It's also 
more powerful than either 'locate' or FINDIT.COM because 
'find' can also find files based on their write dates, last 
access dates, and sizes.  Say you just wrote a file, but you 
forgot what you called it.  ;-)  'find' can use this syntax:

$ find <starting directory> -ctime <days old>

example:  
(note the file extensions... hadda get that in too.  ;-)

$ find ~/twoloons -ctime 1
/home/steve/twoloons
/home/steve/twoloons/Java_Kayumas_labels.wpd
/home/steve/twoloons/invoice.wpd
/home/steve/twoloons/Priority_address_label.wpd
/home/steve/twoloons/label.ps
/home/steve/twoloons/Panama_labels.wpd

  Then by size...

$ find <starting directory> -size<k>

example:

$ find ~/ -size 1000k  

  This command will find all files that are 1000k in size.
In order to find files which are larger than 1000k, you 
simply prepend a + sign to the size, so:

$ find ~/ -size +1000k

  Oh, man!  That's a lot of files.  I wonder how many there 
are?

$ find ~/ -size +1000k | wc -l
    95

(The | works as in DOS.  It uses the output from one command 
as input for the next.  'wc' is the "word count" command, 
-l means to count lines)

  And what if you want to see the full directory info 
instead of just the filename.  Combine commands in a 
different way to do that.  :-)

  example: 
(show full directory listing on all files larger than 9000k)

$ ls -l $(find ~/ -size +9000k)

This is a simple nesting of commands, where the command 
inside parenthesis is executed first and the result held in 
memory (actually as an unamed variable).  The contents of 
the variable are then acted on by the command outside the 
parenthesis.

  Anyway... that's a nice beginning on the ways you can 
make use of the 'find' command.  :-)

-- 
Steve Ackman
http://twoloonscoffee.com       (Need green beans?)
http://twovoyagers.com          (glass, linux & other stuff)

Reply via email to