Prev: Finding the largest files in a filesystem (or highest values in a list) quickly
Next: global Aqua+Terra MODIS (MCD43B4) mosaic with ncget-hdf, NetPBM and ImageMagick
From: Stephane CHAZELAS on 25 Jan 2010 14:35 2010-01-25, 11:21(-08), Dan Stromberg: > > I recently updated my "highest" program to optionally use a heap or > treap, giving it a nice additional performance boost. > > http://stromberg.dnsalias.org/~dstromberg/highest/ > > It's a pretty common operation in shell scripts and *ix > administration, so it seemed worth optimizing a bit beyond the > traditional "sort -r | tail", especially now that filesystems now will > often hold millions of files; as filesystems continue to grow, this > optimization will likely gain in value (though GNU sort is pretty good > if you throw enough physmem at it). [...] for information, zsh has some interesting features when it comes to find largest/newest/... files. ls -ldU -- **/*.pdf(OL[1,5].) would report the 5 largest pdf regular files in the current directory and its subdirectories (-U is a GNU ls option to disable sorting). O is for "reverse order" (short for ^o), L for length, you can also sort by number of [l]inks, [a]ccess, [m]odification, inode [c]hange time, by name (the default as in other shells) or not sort at all. "." is for regular files, [1,5] to only report the first 5 files (up to 5). I don't know how it compared to "highest" or "sort" in terms of performance, I don't expect it to have been much optimized. -- St�phane |