File Sizes & “Human Readability”

File sizes in Linux can be a nightmare, if you’re not fluent in bytes. These should help make things more human readable..

To check directories for largest filesize
du -Sh

To sort directories in order of largest, listing only top 10 largest
du -Sh | sort -nr | head -n10

To check directories outside of the one you are currently in
du -Sh /var

To check for the largest file
du -ah

Likewise to sort files in order of largest, listing only top 10 largest
du -ah | sort -rh | head -n10

To view a directory using LS but with “human readable” file sizes
ls -altr --block-size=M

Leave a Reply

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