3 ms·
Linux - disk usage (du) human readable and sorted by size
This is quick tip to fix a problem that has always bugged me - When showing disk usage in a human readable form (KB, MB, GB) for each subdirectory using “du -sh *”, how can you properly sort it into size order?
- nailer 18y agoThis is a good argument for seperating content from presentation, in the same method an object shell does. For every workaround, there's still the underlying issue needing workarounds in the first place.
- jsares 18y agothis is my solution, comments? du -s * 2>/dev/null | sort -n | cut -f2 | xargs du -sh 2>/dev/null