How to search for large files >1Gigabyte via command line
Cameron Simpson
cs at zip.com.au
Wed Aug 15 22:46:09 UTC 2012
On 15Aug2012 07:24, NOSpaze <nospaze at gmail.com> wrote:
| On Mon, 2012-08-13 at 20:41 +0100, Aaron Gray wrote:
| > On 13 August 2012 19:53, Jack Craig <jack.craig.aptos at gmail.com> wrote:
| > du -ahx * | sort -rh | head -30
|
| Kinda same approach with find, just for files...
|
| find . -type f -print0 | xargs -0 du -h | sort -hr | head -30
Using "du" on a file is overkill. (Unless you have a lot of sparse files
in play, uncommon.)
Try:
find . -type f -ls | sort -rn -k 7 | sed 30q
"head" is for the weak!
Note: sort's "-h" option (needed for du's -h output) is a GNU-specific
and _recent_ addition to GNU sort. Not very portable - your scripts will
break on many platforms.
Cheers,
--
Cameron Simpson <cs at zip.com.au>
I have seen all the works that are done under the sun;
and, behold, all is vanity and vexation of spirit.
More information about the users
mailing list