How to sort the result of du -h command

To sort the result of “du -h” command, you can use

du -h --max-depth=1 | sort -h

If you want to list files in current files also, you can use

du -ah --max-depth=1 | sort -h

If you want to display files in KB, you can use

du -k --max-depth=1 | sort -n

Back to Disk Usage

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *