51 |
You can also do this with just
du . Just to be on the safe side I'm using this version of du :
The approach:
Breakdown of approach
The command
du -ah DIR will produce a list of all the files and directories in a given directory DIR . The -h will produce human readable sizes which I prefer. If you don't want them then drop that switch. I'm using the head -6 just to limit the amount of output!
Easy enough to sort it smallest to biggest:
Reverse it, biggest to smallest:
Don't show me the directory, just the files:
If you just want the list of smallest to biggest, but the top 6 offending files you can reverse the sort switch, drop (
-r ), and use tail -6 instead of the head -6 .
|
Monday, March 27, 2017
Sorting files according to size recursively
http://unix.stackexchange.com/questions/88065/sorting-files-according-to-size-recursively