Faster Searching !

john bray jmblin at comcast.net
Mon Feb 7 08:22:09 UTC 2005


On Sun, 2005-02-06 at 22:23 -0500, fly over wrote:
> Hi Guruz ,
> 
> I want to ask about the fastest searching command as i am using to search SUID/GUID files in / directory . script given as:
> 
>         ls -l /usr/bin | awk '/^-.....[s]/ { print $3, $9 }'
> 
> or using 'find' utility as below
> 
> 
>         find /usr/bin -perm +6000
> 
> 
> 
> now the question is  Which works faster, script without 'find' or with it? and How do you know?
> 
> thankx.

i'd use find.  and only in part because of awk being generally slow.  if
you use ls on a directory that has an unknown number of files, it can
blow out the command line buffer and you get GIGO results, if any.

john




More information about the fedora-list mailing list