On Mon, May 16, 2005 at 01:24:49AM +0100, Paul Jakma wrote:
> On Mon, 16 May 2005, Brian Brazil wrote:
>> >That works, but it spawns a 'ls' process for every file it finds which
> >slows it down. 200s on my homedir (80k files).
> >By changing it to
> >find . -xdev -type f -print0 | xargs -r0 ls -l | sort -rn +4 | head -20
> >the number of processes is reduced, taking only 4.3s.
>> errr... doesn't GNU find have a -ls option?
>> Eg: time find /var/tmp/ -type f -ls | sort -rn +6 | head -20
>> seems to get (the lowest typical figure anyway) about:
>> real 0m0.525s
> user 0m0.122s
> sys 0m0.048s
I tried this too, it takes ~2s on my homedir. I put the extra .9s down
to the IO time for extra info that -ls adds and sort having to move it
around. Also the output of find -ls can be a bit cryptic due to the
inode number and kilobyte count, so I rejected that in favour of
something that outputed only the size and path. The -printf can be
tweaked to add more info if its needed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 185 bytes
Desc: not available
Url : http://mail.linux.ie/pipermail/ilug/attachments/20050516/c70813a7/attachment.pgp
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!